PDA

Click to See Complete Forum and Search --> : Crystal 8 [Changing Report Location]


Rohan_Powle
Mar 15th, 2004, 02:37 AM
Hello There,
I have used OLEDB Provider for connecting to MS-Access XP Data Source while making Reports for my Application.

If the client installs Application on another Location than specified while making the report, App throws error "Server cannot be found", I am using RDC & Report Viewer to view reports from VB6.

How do I dynamically change the Report location using RDC Code.
If u can give me some sample code I will be really grateful.

Help will be appreciated

Rohan_Powle
Mar 16th, 2004, 04:12 AM
Is there anyone who can help ... client is unhappy as he says why do I install Application in a particular Drive only. I hv asked him to wait for a while to solve the problem. :rolleyes:

Rohan_Powle
Mar 16th, 2004, 04:14 AM
This is the Code I am trying to change the Location but it is not doing the needful :(


Dim crxDatabaseTable As CRAXDRT.DatabaseTable
'Set instances
Set puReport = crxApp.OpenReport(sReportPathName, 1)
'Change Database Location

Dim sdbPath As String
sdbPath = App.PATH & "\_Data\DailyAcc.mdb"

For Each crxDatabaseTable In puReport.Database.Tables
crxDatabaseTable.SetTableLocation sdbPath, crxDatabaseTable.Name, ""
MsgBox crxDatabaseTable.TestConnectivity
Next crxDatabaseTable

'TRIED THIS TOO BUT DID NOT WORK

'For lCtr = 1 To puReport.Database.Tables.Count
' puReport.Database.Tables(lCtr).SetTableLocation sdbPath, puReport.Database.Tables(lCtr).Name, ""
' MsgBox puReport.Database.Tables(lCtr).TestConnectivity
'Next




is there no one who can handle this problem? :eek:

D12Bit
Mar 17th, 2004, 07:26 PM
You need to set the access to the data in your Report to Active Data in order for you to set a different source for your report...

then ...(I recommend the use of ADO) you create a recordset exactly as you have it set in the report ... so the report can find the fields exactly as you used it when designing it...

after that you just need to se in the for that opens the report the following:

'just showing the part that really matters...
Report.Database.SetDataSource rsADO 'this is where you assign the recordset
'contining the data that you want to print ...
'obtained from wherever you like
Report.DiscardSavedData

CRViewer1.ReportSource = Report