Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 21st, 2009, 03:19 AM
Afi83 Afi83 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2009
Posts: 5 Afi83 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 50 m 53 sec
Reputation Power: 0
Changing database file from VB6 for Report

Hi there
I have an application in VB6 I want to use Crystal report (8.5) for reporting. In my application I have a ability to archive part of my database. Then I want to change my database location based on my database name. In my report I have subreport then I search about and find something to loop through all sections of report. The bellow code works fine just for my base database. But when I change database to archive one the report is empty.
The structure of two databases is exactly same then the problem is not there.
But I have to say basic report is based on the basic database then maybe this is the problem that I can't change the database through run time.
Please say me how can I prepare my report in crystal that can show from multiple database names.
Here is code:
Code:
Public CrxApp As CRAXDRT.Application
Public CrxRep As CRAXDRT.Report
Public crxSubreport As CRAXDRT.Report
Public crxSubreportObject As SubreportObject
Public crxDatabase As CRAXDRT.Database
Public crxDatabaseTables As CRAXDRT.DatabaseTables
Public crxDatabaseTable As CRAXDRT.DatabaseTable
Public crxSections As CRAXDRT.Sections
Public crxSection As CRAXDRT.Section
Public CRXReportObject As Object

Public Sub DataLoc(DataName As String, REP As String)
    Dim fi As String
    
    
    Set CrxApp = New CRAXDRT.Application
    fi = App.Path & "\" & REP & ".rpt"
    Set CrxRep = CrxApp.OpenReport(fi)

    Set crxSections = CrxRep.Sections
    
    For Each crxSection In crxSections
        For Each CRXReportObject In crxSection.ReportObjects
           If CRXReportObject.Kind = crSubreportObject Then
             Set crxSubreportObject = CRXReportObject
             Set crxSubreport = crxSubreportObject.OpenSubreport
             Set crxDatabase = crxSubreport.Database
             Set crxDatabaseTables = crxDatabase.Tables
             
             For Each crxDatabaseTable In crxDatabaseTables
    'If you are using a  Native connection to PC database
    crxDatabaseTable.Location = App.Path & "\" & DataName & ".mdb"
    
             Next
             
             Set crxSubreport = Nothing
           End If
        Next
    Next
    
    
    'Set crxDatabase = Nothing
    'Set crxDatabaseTable = Nothing
    'Set crxDatabaseTables = Nothing
    'Set crxSections = Nothing
    'Set crxSection = Nothing
    'Set crxSubreportObject = Nothing
   ' Set crxReport = Nothing
   ' Set crxApplication = Nothing
End Sub


After this code I set my crystal viewer to Crxrep and it shows my report on base database.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming > Changing database file from VB6 for Report


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump




 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 




© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 4 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek