Parameter report in code

pdbowling

Registered User.
Local time
Today, 20:23
Joined
Feb 14, 2003
Messages
179
Hey all.
I've got a parameter query that feeds a report.

I'd like to call the report in code and feed it the parameter. I thought the following code would do it, but I still get the parameter prompt [Enter Vendor Number]. Any suggestions?

PB

Text0.SetFocus
myVendorNum = CInt(Text0.Text)
stDocName = "myReport"
stcondition = "[Enter Vendor Number]=" & myVendorNum <==number field
DoCmd.OpenReport stDocName, acViewPreview, , stcondition
 
DoCmd.OpenReport has to use a valid SQL WHERE condition but without the WHERE clause:

try :
stcondition = "VendorNumber=" & myVendorNum

My guess is that the WHERE condition doesn't recognise "[Enter Vendor Number]=" and therefore cannot evaluate it - prompting you for input.

The VendorNumber shown above is the table field name containing the field you wish to apply the search criteria on.
 

Users who are viewing this thread

Back
Top Bottom