I have four tables each with its own form, all these table share same column which is the unique id. How do i update other tables when i add new row in one form at same time, that is how do i get a row in other tables with unique id and other columns being empty?
Is there a way to specify more than one control source to the unique id field?
I tried the approach in making one to one relationships between unique id in one table to other tables unique ids But this did not work.
You could execute INSERT statements from the form’s before or after insert events. If your form has a text box named txtID bound to the ID field in the form’s record source:
That approach assumes all the fields in those tables other than the ID fields will accept Null values (in table design view, the Required property is No).
But it might be better to do this from the before insert event, and cancel the INSERT for the current form if any of the other inserts fail. And in that case you may also want to roll back any of those other inserts which succeeded — this could easily get more complicated.
Edit: I gave you a very rough outline. Now that you’re getting the too few parameters message, suggest you revise it along these lines so you can view the exact INSERT statements you’re asking the db engine to execute.
You can view the output from those Debug.Print statements in the Immediate window. (You can get to the Immediate window with Ctrl+g) You can also test any of those statements by copying it from the Immediate window and then pasting it into SQL View of a new query.
Edit2: If Record_Num is text (such as R98609) rather than numeric data type, add quotes around the values when you build the INSERT statements.