Multiple Tables, New records

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Here is my problem. to make it simple, I have two tables, A and B. Thses
tables I want to be linked by ssn. I want to create a form so when I create a
new record it will automatically fill in both tables with the same ssn and I
do not have to enter it into two fields
 
Add the field from both tables on your form. Make one of the fields
invisible. In the visible field, set it's after update event to copy the
entry into the other field.
 
Something like...

Private Sub Somefield_AfterUpdate()
Some field = some other field
End Sub
 
Here is my problem. to make it simple, I have two tables, A and B. Thses
tables I want to be linked by ssn. I want to create a form so when I create a
new record it will automatically fill in both tables with the same ssn and I
do not have to enter it into two fields

Ummm...

No. You almost certainly do NOT want to do this.

Relationships are not about automagically creating empty, placeholder
records in your second table. Such records have a way of never getting
properly filled in.

Instead, create a Form based on TableA, with a Subform based on
TableB. Use ssn as the Master/Child Link Field.

When you enter data on the main form, and then start to enter data
into TableB using the subform, the SSN will fill in automatically
(only when there is real data being added to TableB, not before).

If you're using table datasheets for data entry - don't. They're not
the right tool for that purpose.

John W. Vinson[MVP]
 
Thank you very much, that works great. One note on it though, i found there
has to be a default value in the hidden box in order for it to update/add the
new record.
 
John:

I must have misunderstood. I read this as a one-to-one table. I have done
something similar in the past.

Sorry,
 
You are correct Rick, I am using it as a one-to-one table. As you probably
can see I am new to access programming and for the purpose of our databse I
do not think i need a one-to-many or many-to-many tables. The database is
basically to keep track of 50+ Marines that were injured in Iraq. We do not
have a lot of information but I want to keep the records in an organized
state so when someone else takes over this position it will be alot easier
for him/her to manage.

I appriciate all the help you have given. Thank You
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top