Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Delay VBA(Access) code execution until unbound form is filled out 1

Status
Not open for further replies.

andres28

Instructor
Apr 5, 2006
5
US
I need help. I have a button that brings up a report based on a query that needs user input. I have just been using inputboxes but I need to have a combo box for one of the criteria in the query so I'm using a form for the query fields I need. The problem is that when I click the button to put in the info, it finishes running the code and opens up a blank report because there was no input from the form. Please help.
 
Huh?

The simple answer would appear to be don't click the button until you have finished with all of the required entry on the form.

The more elloquent solution would be to validate that the form is complete with the button's click, and if the form is complete then and only then submit the querry.
 
Sorry I should have been a little more descriptive. What happens is a user clicks the button, Access opens a form with three fields for the query to use-one of which is a combo box. Then when the user clicks OK it needs to return control back to the module that opened it and that module opens the report based on the query. But when it opens the form for input, it doesn't wait for the form to be filled out and opens up a blank report.
 
Launch the report in the Click event procedure of the OK button of the parameters form.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanks PHV I appreciate the help. But I was trying to avoid that if I could. I have several different reports that all use the same parameters and are launched from several different buttons. This approach will work but I was hoping that there was some way to just make access stop its programming until the user clicked ok in the parameters box so I could use the same form for all the reports. If this isn't possible please let me know. Thank you for all your help.
 
Have a look at OpenArgs to pass the report's name the OK button should launch.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top