Automatic Report Parameters

The easiest way to find SQL syntax errors is to copy the string into the SQL view query window or print it in the immediate window with debug.print if it is not too long. The first technique is best since you can try to run the string and see what happens.
 
Must be the Syntax

I seem to be getting prompted for the values that the WHERE condition has in it. For instance:

dim strWhereSQL as string

strWhereSQL = "[MASTER_TYP_ID_ADMINCO] = 53"
DoCmd.OpenReport rsRunningReports!report_name, acViewNormal, , strWhereSQL

The report runs fine when I open it on its own and the query is working perfectly. I have the field name enclosed in square brackets. I can't see where I am going wrong. I looked up this subject on this forum and on www.google as well as www.microsoft.com and I had no luck. Any idea's anyone?
 

Users who are viewing this thread

Back
Top Bottom