Update Records Pop-up Form

  • Thread starter edmiller via AccessMonster.com
  • Start date
E

edmiller via AccessMonster.com

Hi Everyone,

Help is really appreciated.
So I have a form where the user can input data on three different text boxes
then click on a 'search' command button and with simple code the results are
filtered on the same form below in other text boxes. All this is linked to a
single table. So I've set up this results text boxes Enable/Locked property
to Yes because I don't want to allow the user to edit the data on the same
form. However I've created an update command button which opens a new and
more simple pop-up form where the user can modify the data. The problem is
that when the user finds the result on the main form, then clicks on the
update cmdbutton and the new form appears, the previously filtered result is
not displayed but all of the records are displayed.

So what I would like to do is for the user to find the record on the main
form then once he clicks the update button and the new form appears I would
want that the same information that is filtered on the main form appears on
the pop-up update form as well so he can edit it.

Thank you all !
Ed
 
J

Jeanette Cunningham

After user finds the record on the main form, use the Primary Key of that
record to
open the popup form to just that record.

DoCmd.OpenForm "NameOfPopupForm", , "[PKField] = " & Me.PKField, ,
,acDialog

If the primary key is a text field,
DoCmd.OpenForm "NameOfPopupForm", , "[PKField] = """ & Me.PKField & """", ,
,acDialog



Note: replace PkField with the actual name of the primary key field and the
name of the control for the primary key on the form.
I added the acDialog so all code in the main form would stop until the popup
form is closed.
On the unload event of the popup form, you can requery the main form to
update it with the changes from the popup form.


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 

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