Hi,
I am using the following code in VB to run Crystal Reports 8. I am setting the SQL statement at runtime using the SQL Query property. The selection is not returning anything.
Both the 'SELECT' and the 'FROM' are exactly the same as that found in the .qry file.
It seems that the SQLQuery command is not replacing the SQL I used to create the report with. Can anyone be of any help?
crReport1.ReportFileName = "\Report4.rpt"
crReport1.DataFiles(0) = "test.mdb"
crReport1.SQLQuery = _
" SELECT DISTINCT VISITE.DVIS, VISITE.CPR, VISITE.CVM, PRESCRIPTEURS.TITRE, PRESCRIPTEURS.NP, VM.PRENOM, VM.NVM " & _
" From VISITE, PRESCRIPTEURS, VM " & _
" WHERE VISITE.CPR = PRESCRIPTEURS.CPR And VISITE.CVM = VM.CVM " & _
" AND NP = 'SAID CARMEL'" & Chr(13) & Chr(10) & " ORDER BY PRESCRIPTEURS.NP"
crReport1.Destination = crptToWindow
crReport1.WindowState = crptMaximized
crReport1.PrintReport
Many thanks
I am using the following code in VB to run Crystal Reports 8. I am setting the SQL statement at runtime using the SQL Query property. The selection is not returning anything.
Both the 'SELECT' and the 'FROM' are exactly the same as that found in the .qry file.
It seems that the SQLQuery command is not replacing the SQL I used to create the report with. Can anyone be of any help?
crReport1.ReportFileName = "\Report4.rpt"
crReport1.DataFiles(0) = "test.mdb"
crReport1.SQLQuery = _
" SELECT DISTINCT VISITE.DVIS, VISITE.CPR, VISITE.CVM, PRESCRIPTEURS.TITRE, PRESCRIPTEURS.NP, VM.PRENOM, VM.NVM " & _
" From VISITE, PRESCRIPTEURS, VM " & _
" WHERE VISITE.CPR = PRESCRIPTEURS.CPR And VISITE.CVM = VM.CVM " & _
" AND NP = 'SAID CARMEL'" & Chr(13) & Chr(10) & " ORDER BY PRESCRIPTEURS.NP"
crReport1.Destination = crptToWindow
crReport1.WindowState = crptMaximized
crReport1.PrintReport
Many thanks