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!

Passing data from one field to 3 subforms simultaneously...

Status
Not open for further replies.

LexSteel

Programmer
Dec 19, 2001
6
US
I have a combobox bound to an empID field on a master form and I need it to create a new record and update the empID fields in 3 subforms simultaneously using the afterupdate event. My inept code only generates errors and I'm running out of time on this project, so any advice would be appreciated. Thank you in advance from a desperate, beginning developer
 
Dim rst As Recordset

Set rst = CurrentDB.OpenRecordset(&quot;<table name>&quot;, dbOpenDynaset)
rst.AddNew
rst!<field> = Me.<field>
...<same for all fields to update>
rst.Update

<repeat above code for each subform's source>

Me.Requery

I'm not sure which library allows for recordset operation. I think it's Microsoft Visual Basic for Applications Extensibility 5.3 (something like that). It could be MS Access 9.0 Object Library or MS DAO 3.6 Object Library.
As you can see, the basic idea is to update the source table(s), then requery to update the form. In case this causes the form to go to the first/last record rather than stay at the current record, you can use a bookmark object:

Dim bmk As Bookmark

(before performing above recordset operations)
bmk = Me.Bookmark

(after requerying)
Me.Bookmark = bmk
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top