By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,149 Members | 885 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,149 IT Pros & Developers. It's quick & easy.

Can I have one form save information to 2 tables?

P: 283
Hello everyone that is reading this,

What I want to do is have my form be able to save the information you type in to 2 seperate tables. I have one table we can call the MasterTable that will save everything that is typed in. The second Table we can call (SubTable) I only want to save parts of the information. Not everything like the MasterTable. I tried to set up a relationship linking parts of the two tables together but that does not seem to work. I know that it can be done just wondering how?

Thanks in advance
Mar 12 '10 #1
Share this Question
Share on Google+
1 Reply

Expert Mod 15k+
P: 31,494
This is sort of possible, speaking generally, but I suspect that you would like the same data store to more than one field. IE. One in one table, and another in the other one. Let's talk some fundamentals for a second.
  1. If the RecordSource for a form is a query, and that query is formed of multiple tables linked together AND is updatable (See Reasons for a Query to be Non-Updatable), then that form can write to multiple tables concurrently.
  2. Each control on the form can be bound to only one field from your RecordSource. If you had a control [First Name] for instance, and this was required in both of your tables, it could not be bound to both.
  3. With a little VBA work and some imagination, you could create a bunch of other controls on your form, which may be invisible, and these could be made duplicates of the ones you can see. These could then be bound to your alternative table fields. I suggest the code could go in your control AfterUpdate event procedures, but I would consider using the form's BeforeUpdate procedure instead. That way all code need only be processed once, when you're sure it's required.
Mar 13 '10 #2

Post your reply

Sign in to post your reply or Sign up for a free account.