How to Open Form Before Record Source Query

  • Thread starter Thread starter ridgerunner
  • Start date Start date
R

ridgerunner

I have reports and forms that use queries as their record sources. The
queries contain parameters like [Forms]![fdlgdate]![Date]. I would like for
the reports and forms to open the "fdlgdate" form to collect the date before
the query runs. My users do not want to type the slashes between
month/day/year and the "fdlgdate" form takes care of this issue. I have
looked all over this community and cannot find a solution that exactly
matches my problem. I have also tried adding a command to several of the
properties of one of the forms (like "on open") to open the form first, but I
am having no luck. The query still opens with a parameter dialog box, which
cannot use a date input mask. This seems like such a simple thing to do.
Can someone please help.
Thanks,
ridgerunner
 
I have worked on this all day to no avail. I cannot get the report to open
the dialog form before the record source query opens the parameter dialog
box. Any help will be greatly appreciated. Am I trying to do the impossible?
 
For reports you can try using Open Event and put in code like the following.

DoCmd.OpenForm "fdlgDate",WindowMode:=acDialog

Then DON"T Close the form after your users have entered the data, just set the
form's visible property to false.

You can close the form in the close event of report.

With a form, you might be able to do something similar with the open event of
the form.



John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
 
Thank you John. I have tried your suggestion with a form, but I cannot stop
the query in the form's record source from popping up the parameter box,
which defeats the purpose of having the "fdlgdate" form. The only way I see
to open a dialog form first to have separate dialog forms for each report and
form (with a button to open the report or form), which I really was trying to
avoid. Seems like a lot of work to only provide a formatted date field for
users to fill in, so they do not have to enter the date separators in the
query parameter box. Thanks again.


John Spencer MVP said:
For reports you can try using Open Event and put in code like the following.

DoCmd.OpenForm "fdlgDate",WindowMode:=acDialog

Then DON"T Close the form after your users have entered the data, just set the
form's visible property to false.

You can close the form in the close event of report.

With a form, you might be able to do something similar with the open event of
the form.



John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
I have reports and forms that use queries as their record sources. The
queries contain parameters like [Forms]![fdlgdate]![Date]. I would like for
the reports and forms to open the "fdlgdate" form to collect the date before
the query runs. My users do not want to type the slashes between
month/day/year and the "fdlgdate" form takes care of this issue. I have
looked all over this community and cannot find a solution that exactly
matches my problem. I have also tried adding a command to several of the
properties of one of the forms (like "on open") to open the form first, but I
am having no luck. The query still opens with a parameter dialog box, which
cannot use a date input mask. This seems like such a simple thing to do.
Can someone please help.
Thanks,
ridgerunner
 
Back
Top