Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB6, Crystal Reports 8 and SQLQuery

Status
Not open for further replies.

ndalli

Programmer
Nov 6, 1999
76
MT
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top