Click to See Complete Forum and Search --> : Update same field in multiple table
lovely_tao
September 28th, 2001, 09:26 PM
I need to design an database which has five tables. I would appreciate if anyone can let me know how to perform this function:
when I click on update in one table, the same field which also locates on other table has to be updated as well... how do I do that ?
Please help !!!!!
THANK YOU !!!!
dcaillouet
September 28th, 2001, 09:56 PM
Two observations:
1. The best method to do this may depend on which database you are using. Does your database have triggers?
2. If you have a field that needs to stay synchronized across five different tables, then your database is not normalized. The solution may be a better database design. My gut feeling is a database that has this design will be a problem to maintain.
lovely_tao
September 29th, 2001, 02:56 AM
Thank you for your advice. My database has five forms which one primary key can be a secondary key to another form. This is supposed to be my assignment and I have to no way to alter the design coz I just open the database with the VisData Add-In and has to think about how to update the record in different tables on my own.
I am a real beginner, so I don't know what is a 'trigger'.
Thank you anyway.
dcaillouet
September 29th, 2001, 11:02 AM
In some databases (SQL Server, Oracle, DB2, etc.) you can specify a piece of code called a trigger that will run whenever an specific event (insert, update, delete, select) happens to a table. You would write an update trigger for each table that would update the other four tables each time a record was changed.
As to your original problem, whenever any one of the tables is updated I would just go ahead and submit an update query against the other four tables for the one field you want to keep in sync.
brainfire
September 30th, 2001, 03:10 AM
i can suggest you a way .ido not know if this is suitable but it works.
what you do is dim ado.recordsets and connect to those databases and update the fields you disire by update statements.
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.