Requery Question

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.
 
A

Allen Browne

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.
 

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

Similar Threads


Top