Auto enter data into 2 fields

C

C. Sharp

I have 2 tables: TBL_Corporate and TBL_Client. We enter the corporate name,
etc.. in the first table but in the second table if we enter the CORP ID it
will link those 2 tables. Is there a way if I enter CORP ID as 77 that it
will auto enter the Corporate name from the first table into the second table?
 
C

Carl Rapson

Not if you're entering information directly into the tables, because tables
don't have events you can trap. You'd need to enter your data through a
form, where you could trap the AfterUpdate event on the control bound to the
CORP ID field and write VBA code to insert the Corporate name.

That said, you can do it that way, but you shouldn't. If you have the CORP
ID in the TBL_Client, why do you need to store the Corporate name there
also? Just do a lookup on the CORP ID from TBL_Corporate any time you need
the name.

Carl Rapson
 
J

John W. Vinson

I have 2 tables: TBL_Corporate and TBL_Client. We enter the corporate name,
etc.. in the first table but in the second table if we enter the CORP ID it
will link those 2 tables. Is there a way if I enter CORP ID as 77 that it
will auto enter the Corporate name from the first table into the second table?

You shouldn't.

Relational databases use the "Grandmother's Pantry Principle" - "a place - ONE
place! - for everything, everything in its place". Store the Corp_ID in the
Client table; if you need to see the corporation name in conjunction with
client data, use a Combo Box storing the ID but displaying the name, or use a
Query joining the two tables.

John W. Vinson [MVP]
 

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