Dialog Box Query

T

Tim

I am trying to run a query based on dates pulled from a
form. The query works fine but I want to use the form to
enter the dates when the query is ran. The form contains
two fields. One for a beginning date and one for an
ending date. When I run the query I get two dialog boxes
prompting me for the values instead of the form opening
up. The criteria syntax is:

Is Not Null And Between [Forms]![frmDateRange]!
[BeginningDate] And [Forms]![frmDateRange]![EndingDate]

Should this open the form? If not, is there another way?

Thanks for help in advance.

-Tim
 
W

Wayne Morgan

No, it won't open the form. The form will have to already be open. Is there
another way? Yes, several. It depends on what you're trying to do. How are
you running the query? If it's for a report, you could open the form in the
report's Open event using the acDialog window mode argument then hide the
form (Visible=False) when you've filled in the values. This will allow the
code to continue running and the data would be there for the query. Close
the form when you close the report.
 
G

Guest

You da' man Wayne! That works well.
Thanks a bunch!
-----Original Message-----
No, it won't open the form. The form will have to already be open. Is there
another way? Yes, several. It depends on what you're trying to do. How are
you running the query? If it's for a report, you could open the form in the
report's Open event using the acDialog window mode argument then hide the
form (Visible=False) when you've filled in the values. This will allow the
code to continue running and the data would be there for the query. Close
the form when you close the report.

--
Wayne Morgan
MS Access MVP


I am trying to run a query based on dates pulled from a
form. The query works fine but I want to use the form to
enter the dates when the query is ran. The form contains
two fields. One for a beginning date and one for an
ending date. When I run the query I get two dialog boxes
prompting me for the values instead of the form opening
up. The criteria syntax is:

Is Not Null And Between [Forms]![frmDateRange]!
[BeginningDate] And [Forms]![frmDateRange]![EndingDate]

Should this open the form? If not, is there another way?

Thanks for help in advance.

-Tim


.
 

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