the above code won't work with crpt10.
it is limited to version 8.5 only as their is no crystal report control available with versions 9 and above. all there is crystal report viewer. and its syntax is completely different.
Public Sub DailyReportDisplay(Query As String)
Set CRXReport = CrystalReport2
Set CRXDb = CRXReport.Database
inti = 1
Do Until inti = CRXReport.Database.Tables.count + 1
CRXReport.Database.Tables.Item(inti).SetLogOnInfo strdblocation, "<your table name>", "<user id>", "<password>"
inti = inti + 1
CrystalReport2.SQLQueryString = Query
.CRV1.ReportSource = CRXReport
Set CRXReport = Nothing