You can use the .SetTableLocation method.
sample code below:
lcConnStr = "PreQEServerType=ODBC - " + gcDataSource + ";;PreQEServerName=" + gcDataSource + ;
";;PreQEDatabaseName=" + oCompany.cDBName + ";;UserId=" + gcUID + ;
";;UseDSNProperties=0;;Password=" + gcPassWord
For i = 1 To oReport.Database.Tables.Count
oReport.Database.Tables(i).SetLogOnInfo( cServer, cDataBase, cUser, cPwd)
oReport.Database.Tables(i).ConnectBufferString = lcConnStr
oReport.Database.Tables(i).SetTableLocation(.Name, "", .ConnectBufferString)
Next
Rene
Hi,
All time that I modify the name of the server or the database I have that to enter in the way to designer of the report and to have access menu database- set datasource location and to bring up to date table for table...
I am using 8.0 VFP and Crystal 9.0
It sees the code below:
Local oReport_Application As Object
Local oReport As Object
oReport_Application = Createobject("CRYSTALRUNTIME.Application")
oReport = Createobject("CRYSTALRUNTIME.Report")
oReport = oReport_Application.OpenReport( cReport)
oReport.RecordSelectionFormula = cFormula
oReport.MorePrintEngineErrorMessages = .T.
oReport.EnableParameterPrompting = .T.
oReport.ReportTitle = cTitulo
For i = 1 To oReport.Database.Tables.Count
oReport.Database.Tables(i).SetLogOnInfo( cServer, cDataBase, cUser, cPwd)
Next
oReport = Null
oReport_Application = Null
It ignores the SetLogOnInfo() ??
Breno Lucas Viana
http://www.wmsistemas.com.br