Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...you guys have given us a way of asking a question and getting some very timely feedback from other users so we don't have to re-invent the wheel time and again..."

Geography

Where in the world do Tek-Tips members come from?
CVesta81 (TechnicalUser)
17 May 12 13:51
Hi!

I have an Access database with three main tables, "tbl1Customers (MASTER)", "tbl2Contacts (MASTER)", and tbl3Addresses (MASTER)". For simplicity purposes, I will refer to these tables as Table1, Table2, and Table3 respectively. I want to be able to add a new record to Table1, and have that record also append to Table2 and Table3, in order to be able to perform data entry in Table2 and Table3. Currently in my form, I cannot perform data entry because when I add a new record in Table1, it does not get added to Table2 and Table3 and I get an error message when I try to do so.

Currently I have a form for specifically creating a new record in Table1. When I close the form (OnClose) I want the other two tables to be appended with the same primary key information. In this case the primary key for each table (1 to many relationship) is a field called, "CustomerNo".

Let me know if you need any further information about my problem. I appreciate your help!

Chris V.
PHV (MIS)
17 May 12 13:59
CVesta81 (TechnicalUser)
17 May 12 14:01
PHV,

Is there any VBA code I would need to use, or just simply set up the two linked forms with the primary keys?
CVesta81 (TechnicalUser)
17 May 12 14:48
I can't seem to get this to work. Could you give a little more detail as to how to do it? When I set up the two subforms, they are blank. I'm guessing because the new customer number doesn't exist in the table yet? I'm still confused as to how to get the new customer number in each table.
PHV (MIS)
17 May 12 15:30
HAve a look at the LinkMasterFields and LinkChildFields properties of the subforms.

Hope This Helps, PH.
FAQ219-2884: How Do I Get Great Answers To my Tek-Tips Questions?
FAQ181-2886: How can I maximize my chances of getting an answer?

CVesta81 (TechnicalUser)
17 May 12 15:43
I have done this and everything matches up. When I load the form, the subforms are completely blank, even when I add data to the main form. Is there something else I'm missing?
dhookom (Programmer)
17 May 12 16:12
The question is why do you want to add related records without anything unique to them? When you want a record, you just go to the subform and enter the new record in the related table. The Link Master/Child properties will maintain the primary/foreign key values.

Duane
Hook'D on Access
MS Access MVP

CVesta81 (TechnicalUser)
17 May 12 16:36
So here is the issue in a nutshell. I am trying to create a database for data entry. The database has been created but I can't get the data entry part to work. When I try to create a new record utilizing a form linked to Table1, I am fine. The problem is that when I try to update information for Tables 2 & 3, I can't do it because the unique identifier (Customer No and Organization No) do not exist in those tables. I am trying to figure out why this is because I have set up all the relationships in the table to be a 1 to many relationship. (Table1 to Table2 is a 1 to many relationship, and so is Table1 to Table 3). I've not created a database before for data entry that utilizes three different tables. Any thoughts?
dhookom (Programmer)
17 May 12 17:01
You should have a main form with two subforms: one for table2 and one for table3. Set up the Link Master/Child properties as suggested earlier.

If you can't figure this out, come back with your form and subform record sources as well as your table structures.

Duane
Hook'D on Access
MS Access MVP

CVesta81 (TechnicalUser)
17 May 12 18:09
There must be something screwed up with my relationships in my database, because the Master/Child properties are correct. I have all forms set for Data Entry but only the main form shows. As an alternative method, is it possible to run an Append Query when I close the form? I would envision the Append Query would create new records in each of the other two tables with the Organization No and Customer No using information from the main form.
dhookom (Programmer)
18 May 12 1:30
I would try to figure out what isn't working with the solution that has been suggested and is used nearly universally. You haven't provided any information about your record sources or other significant stuff.

It is possible to create and run append queries in the on close event of a form.

Duane
Hook'D on Access
MS Access MVP

TheAceMan1 (Programmer)
19 May 12 23:19
How are ya CVesta81 . . .

Quote (CVesta81)

There must be something screwed up with my relationships in my database ...
The thread sure reads screwed up, and until you post what those relationships are we can't help you. Post the Record Source of the form and subforms as well.

See Ya! . . . . . .

Be sure to see FAQ219-2884: How Do I Get Great Answers To my Tek-Tips Questions? Worthy Reading! thumbsup2
Also FAQ181-2886: How can I maximize my chances of getting an answer? Worthy Reading! thumbsup2

CVesta81 (TechnicalUser)
20 May 12 0:52
Actually, I solved this one onmy own. I used a pass through public variable and then assigned a each table the ID. thanks for your help!

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close