Requery Question

  • Thread starter Thread starter Tee See
  • Start date Start date
T

Tee See

I would like to use a small popup form to enter data into a table. The popup
form activates from a command button on a much larger form which is based on
queries. The data which I am inputing pertains to a unique item code which
appears on the larger form.
1) How do I have that item code appear on the popup form when it opens and
2) How do I get the main form to refrexsh with the new data just entered
after I close the popup form and return to the main form.

As always suggestions greatly appreciated.
 
1. Use the WhereCondition of OpenForm.
This example assumes you have a primary key named ID (Number type field):
DoCmd.OpenForm "Form2", WhereCondition:="ID = " & [ID], WindowMode:=acDialog

2. In the AfterUpdate event of the popup form, requery the original:
Forms("Form1").Requery
It will then return to the first record, and you will need to find the same
record again.

You may strike concurrency issues when trying to open 2 forms into the same
area of the database. Naturally, you will make sure the original form is not
dirty, but you may strike problems anyway, particularly with memo fields.
 
Back
Top