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!

Forms data won't update each other after new record is entered

Status
Not open for further replies.

sswedeen

Technical User
Dec 6, 2005
7
US
Situation: I have two very simular forms, One is called Emergency contact (EC), the other is Emergency contact update (ECU). The EC is view only (enabled Field properties is set to no) with bound data form. The ECU is the editable version of the EC and is also bound data.
The Problem: When I enter a new record in the ECU then close it, Because the EC is already open, the new data from the ECU is not automatically updated for viewing in the EC form. I have to close the EC form and reopen it to view the new record.
How can I get the new record to automatically update so I don't have to close the EC form and reopen it?
 
Have a look at the Requery method of the Form object.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
I'm sorry what you just said is greek to me. Is this an event procedure I use? Do I use code, Marco or expression builder? Would I use the event procedure ongotfocus?
 
How and where is the ECU form open ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
I have a Main form that provides General information about our client. In that form I have a button that opens the EC and from the Open EC form I have a Open ECU button which opens the ECU for updating purposes.
 
Can You make a macro in ECU form that is named after_insert or something like that that simply syas forms!EC.update?
 
Sswedeen,

Yup, you'll have to use event procedures %-(

You'll need to Requery the form (basically, add the new record to the form's dataset). The problem with requery is that it will move the form recordset back to the start. So, you'll then have to move to your new record.

For your two forms, something like this should help:

Code:
dim rst as DAO.Recordset
dim frm as Form

'Reference the read-only form
set frm = Forms![COLOR=red]EC[/color red]

'Update the dataset to include your new record
frm.Requery

Reference the dataset
set rst = frm.Recordset

Find the record that has just been added
rst.FindFirst "[YourIDField_EC] = " & Me.[YourIDField_ECU]

'Move the EC form to the new record
frm.Bookmark = rst.Bookmark
Put this into the click event of a button created on the ECU[/color blue] form.

You might have to tinker, typed on the fly...

HTH, Iain
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top