Parameter query

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a subform whose source is a parameter query. How can I programatically
change query parameters and refresh subform without showing "Enter Parameter
Value" dialog?
 
John said:
I have a subform whose source is a parameter query. How can I programatically
change query parameters and refresh subform without showing "Enter Parameter
Value" dialog?


Eliminate the parameter prompt and use an unbound text box
in the form's header section instead. The query's parameter
will then look like Forms!mainform.thetextbox

Users can then enter the value on the form and you can the
the text box's AfterUpdate event procedure to requery the
subform:
Me.subformcontrol.Form.Requery

Then you can set the text box's value and requery the
subform from any procedure in the main form:
Me.thetextbox = somevalue
Me.subformcontrol.Form.Requery

Or from a procedure in the subform:
Parent.thetextbox = somevalue
Me.Requery
 
OR

Set up a single record table with your parameters in there.
Add this table to your query, but Do NOT link it to the existing table(s) in
the query.
From there you can either allow the users to update, or use DAO to update,
your single record table, and just re-run the query.

One advantage of this is that you will have a record of what the parameters
were the last time the query was run. So it could be that you need to run
this query for every day since the last time it was run. (Your user has a
couple of days off, but still needs it done for the missing days. - A simple
loop updating your parameter table and running the query till it gets to
today does the job easily.)

Plus: depending on what your program is doing, the user may not need to make
any input at all.

Any good??
 
Back
Top