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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL at runtime

Status
Not open for further replies.

Roach

Programmer
May 8, 2001
2
ZA
Hi All,

I have an application (VB6 / Access) that I first created a report using Crystal 4.6.
After completion, I then needed to have the user change the SQL statment at runtime.

AS I was unable to get this to work, I then installed Crystal version 8 and converted the reports to version 8.
Unfortunatly, I still canot get it to work.

Below is a sample of the code I have been trying:

This works OK

Select Case True
Case optReports(0)
Dim IS_Report As New IS_Report
frmViewReports.CRViewer1.ReportSource = IS_Report
frmViewReports.CRViewer1.ViewReport

This however, produces the error, file not found:

Select Case True
Case optReports(0)
Dim IS_Report As New IS_Report
Dim strSQL As String

strSQL = "SELECT qryTotalByMonth.`dDate` FROM `qryTotalByMonth` qryTotalByMonth WHERE (((qryTotalByMonth.`dDate`) = #1/31/2001#))"

IS_Report.Database.Tables.Item(1).SetLogOnInfo App.Path & "\Values97.mdb", "", "", ""
IS_Report.Database.Tables.Item(1).Location = "qryTotalByMonth"
IS_Report.SQLQueryString = strSQL

frmViewReports.CRViewer1.ReportSource = IS_Report
frmViewReports.CRViewer1.ViewReport

Any advice on this would be greatly appreciated.

Regards,
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top