Add data to relational tables.

I

iholder

How do you add data to relational tables. Example: The main table is
"tblCustomerProfile" and two relational tables called "tblParkways"
"tblFleetInformation"
When I add a new customer I need to add information to the two relational
tables.
 
J

John Vinson

How do you add data to relational tables. Example: The main table is
"tblCustomerProfile" and two relational tables called "tblParkways"
"tblFleetInformation"
When I add a new customer I need to add information to the two relational
tables.

Use a Form and a Subform.

For a more detailed answer, please post a more detailed description of
the table structures. Does each Customer have multiple Parkways
(sounds odd)? How is tblFleetInformation related to
tblCustomerProfile?

John W. Vinson[MVP]
 
A

Allen Browne

In most cases, you would not need to add a record to the related tables each
time you add a record to the main table.

If you do need to do that, the main record must be entered through a form.
Then use the AfterInsert event procedure of that form to build an Append
query statement string, and execute it:
Private Sub Form_AfterInsert()
Dim strSql As String
strSql = "INSERT INTO ...
dbEngine(0)(0).Execute strSql, dbFailOnError
End Sub

If you are not sure what the Append query statement should look like, mock
one up in the query design window, using any old literal values. Change it
to an Appen query (Query menu). Then switch to SQL View (View menu) for an
example of the string you need to create.
 
I

iholder

This program issues permit to each customer to travel certain parkways. The
parkways table is a list of parkways the customer is allowed to travel. The
fleet table is information about their fleet of vehicles used for
transportation. So when a new customer is added these tables must be added.
Each table is unique to each customer profile. The key field for linking the
table is the CustomerNo.

The form design is: Customer Profile form, which has command buttons to
access the parkways and fleet forms. This is okay if in the edit/view mode.
But in the add mode there is no link if parkways and fleet records are not
added.
 

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

Top