Requery Form

J

JBA

I'm trying to requery a form without success.

I seek to open Form1 in an autoexec macro to an empty record. Then the user
will open a dialog box, enter a name in a text box and click an OK button.
The dialog will close and the selected record will appear in Form1.

Currently, Form1 is based on Query1. The autoexec macro opens Form1 setting
Field1 in the underlying query to a blank record with the code [Field1]="".
In the dialog box, I plan to attach VBA to the OK button. The VBA will
requery Form1 and contain an SQL Where statement that sets Field1 to the
contents of the text box in the dialog. I have two questions.

How do I add an SQL Where statement to the Requery vba code.

Is there a simpler way to select a record to display in Form1. I can put a
reference to the text box as a criteria in Query1 but then I'm unable to open
the form to a blank record in the autoexec macro.

Thanks.

Jim
 
J

JBA

After more research, I concluded that the best answer is a filter. The OK
button on the dialog box runs some vba code that creates a filter for the
form, sets the FilterOn property to true, and then runs a requery on the form.
 

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