Auto Insert

B

Brilandboy20

Hey

Is there is a way to automatically insert info into fields based on what is
inserted in to another field.
What I want to happen is when I insert something into field one I want
field two to be based on what is in field one. They are both stored in
another table in the database.
Ex.
Table 1
Eq# Des.
vh1199 Truck
vh9999 Loader
vh1111 Bobcat

Table 2
Eq# Des
vh9999 I want to auto insert 'Loader' here in this field
 
D

Douglas J Steele

It's not considered to be a good idea to store data redundantly. If you were
to store the description in Table 2, then you'd have 2 places you'd have to
update when vh9999 changes from Loader to Front-end Loader.

You're using a relational database: use it relationally. Only store the Eq#
in Table 2, and create a query that joins to Table 1 and gets the
description from there. Use the query wherever you would otherwise have used
the table.
 
R

Rick B

There is a way, but you don't do that. It would be redundant.

The whole point of a relational database is to store the related data in a
separate table only once. Waht happens (for example) if vh9999 changes in
your table 1? Are you going to go back and change all the fields in table
2? Instead, just maintain the field in Table 1.

When you build any forms, queries, or reports, include both table1 and
table2 in the data source. If you have linked the two tables, then you can
pull the description (stored only once in table1) based on the EQ# entered
in table 2.

This is basic relational database design and normalization.

Look over the sample Northwind database that ships with Access and you
should find several relationships like this as far as the products and
categories goes. Post back if you need more help.
 

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