Anubis3000
Programmer
Hi,
I am trying to execute a query from vb that takes parameters from a form. Currently this is my code:
Dim db As dao.Database
Dim rst As dao.Recordset
Set db = CurrentDb
Dim strsql As String
Dim qdf As dao.QueryDef
Set qdf = db.CreateQueryDef("", "SELECT [REPORT].[REPORT_NUMBER], [REPORT].[REPORT_TITLE] FROM REPORT WHERE ([REPORT].[REPORT_TITLE] aLike ""*(REPORT.REPORT_TITLE) aLike " * " & tester & " * " Or (REPORT.REPORT_TITLE) Like [forms]![RPT_QRY]![REPORT_TITLE] Is Null))
qdf(0) = [Forms]![RPT_QRY]![REPORT_TITLE]
Set rst = qdf.OpenRecordset(dbOpenSnapshot)
When I try to run it, either the sql statement is incorrect, or access does not recognize my parameter (qdf(0)). Any suggestions? Thnx.
I am trying to execute a query from vb that takes parameters from a form. Currently this is my code:
Dim db As dao.Database
Dim rst As dao.Recordset
Set db = CurrentDb
Dim strsql As String
Dim qdf As dao.QueryDef
Set qdf = db.CreateQueryDef("", "SELECT [REPORT].[REPORT_NUMBER], [REPORT].[REPORT_TITLE] FROM REPORT WHERE ([REPORT].[REPORT_TITLE] aLike ""*(REPORT.REPORT_TITLE) aLike " * " & tester & " * " Or (REPORT.REPORT_TITLE) Like [forms]![RPT_QRY]![REPORT_TITLE] Is Null))
qdf(0) = [Forms]![RPT_QRY]![REPORT_TITLE]
Set rst = qdf.OpenRecordset(dbOpenSnapshot)
When I try to run it, either the sql statement is incorrect, or access does not recognize my parameter (qdf(0)). Any suggestions? Thnx.