
Change Database Location at run-time
write a sepparate routine that handles the database location setting. In
english, you must loop through the table collection you are using in your
RPT file. Each table must be set to this new location. Notice in the
following routine that you must use this emediately after you set the
reportnfile name property.
Public Sub set_rpt_db_location(pCRWControl As CrystalReport, pLocation As
String)
Dim wNumOfDataFiles As Integer
Dim wDataFileLoop As Integer
'NOTE: this routine may be called only after the
'ReportFileName property has been set
wNumOfDataFiles = pCRWControl.RetrieveDataFiles
For wDataFileLoop = 0 To (wNumOfDataFiles - 1)
pCRWControl.DataFiles(wDataFileLoop) = pLocation
Next 'wDataFileLoop
End Sub
hope this helps...
Rob Waller
Quote:
>I am using the Designer Component 6 in VB 6 ( database is Access 97, using
>DAO 3.51 ). I need to change the database location of the reports using VB
>code. Pretty simple problem as it seems ... But everything I've tried
>leads to an errror :)
>Any suggestions ?
>thanx