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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simultaneously update two tables from a single entry in a form.

Status
Not open for further replies.

Nyanzi

MIS
Mar 31, 2003
43
UG
Dear all,
I would like to update two tables with the same kind of data simultaneously. I am developing a database that lists members in households. However the household heads also have a separate table. (there is also a table that lists all memberes including the heads.) I would like to develop a form in which you key in the name of the household head and both tables (household head table and all members' table) are updated with the same data simultaneously.

thanking you,
Nyanzi
 
Hi,

You can accomplish it in 2 diff ways

1. Run Update queries based on your form values
2. If both the tables r in relation with each other than you can place the invisible fields on the form and update them through code.

Let me know if you need further explanation

Cheers!
ÙÇãá

It's important to learn the rules so that you know how to break them.
 
Hi

If we leave aside the question of design of your tables (duplication of data is seldom a good idea)

You need to look at SQL Insert, Update and Delete queries, and the DoCmd.RunSQL command

you need (for example) something like

DoCmd.SetWarnings False
DoCmd.RunSQL "UPDATE HeadOfHouseholds SET Field1 = '" & txtBox & "' WHERE Id = " & Me.Id & ";"
DoCmd.SetWarnings True

code such as this could be placed in the after update event of the form

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Hi Aqif,
will you plese give me further explanation, preferably for option 1.

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top