How to get a query to call the parameter form

W

WillyNPG

I am trying to use a form to get query parameter dates as is detailed in the
help article "Make a query ask for input" The query does not open the date
range form when the query is used If the form is opened in advance and dates
entered then the dates in the form are used what is missing? How is the open
form macro called ?
 
M

Marshall Barton

WillyNPG said:
I am trying to use a form to get query parameter dates as is detailed in the
help article "Make a query ask for input" The query does not open the date
range form when the query is used If the form is opened in advance and dates
entered then the dates in the form are used what is missing? How is the open
form macro called ?


Well, there is probably some convoluted way to get a query
to open a form, but you can not guarantee that the form
would be opened and the values entered before the query
tried to use the values.

Instead you need to use some code to open the form before
the query runs. For example, if you want to use the query
as the record source for a report:
DoCmd.OpenForm "your form", WindowMode:=acDialog
DoCmd.OpenReport "your report", acviewPreview
 
J

John W. Vinson

I am trying to use a form to get query parameter dates as is detailed in the
help article "Make a query ask for input" The query does not open the date
range form when the query is used If the form is opened in advance and dates
entered then the dates in the form are used what is missing? How is the open
form macro called ?

You've got it backward.

Queries don't have events that would let you open a form; it's vice versa.
Open the form first, and open the query (or, much better, the report or form
based on the query) from some event on the form - a command button or the
AfterUpdate event of some appropriate control on the form.
 
S

Steve Schapel

Willy,

As I stated in the other group where you posted this...

The behaviour you have described is expected. The form will not, and can
not be made to, open when the query is run. If the query uses criteria
based on the values of controls on a form, then the form has to be open in
advance.

As for the macros, it sounds like you are using Access 2007 and they are
embedded macros. That is fine... but they won't appear in the Navigation
Pane.
 
W

WillyNPG

I believe you are correct Steve. The puzzle is why does the help screen
article include a macro to open the form using the Not IsLoaded("Date Range")
in the condition if there is no way to make the form open before the query
is run. Perhapse it can only work in an application written in VB
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top