How to modify query parameters in code?

E

Everyman

Could someone explain how I can assign a value to a parameter in an
event? What I'm trying to do is get around a prompt for input. I'm
hoping that if I assign a value in the report open event, then the
prompt won't pop up. I've already removed the param declaration from
the associated query, and hardcoded a value, but the prompt is still
coming up, so there must be some reference to it that I'm missing.

Thank You
 
L

Larry Daugherty

Somehow your "parameter in an event" doesn't compute. That would
imply a hard coded value. You would do better to hard code the value
in the criteria line where you and others would expect to find it.

Your report is based on a query. The usual trick is to leave a value
in a control on the form that opens the report. On the criteria line
you refer back to it putting something like the following in the
criteria line:

Forms!MyForm!Mycontrol

If you're getting an unwelcome prompt you may already have a prompt in
square brackets in your criteria line or you may have gone through the
"parameter query" helper which could also evoke a prompt.

HTH
 
K

Klatuu

I would suggest removing the criteria from the query and using the OpenReport
method's Where argument. See VBA Help for details. It will do the filtering
for.
 
Top