Create New table entries when new record created, Any Version (1 Viewer)

aray213

New member
Local time
Today, 06:29
Joined
Sep 21, 2010
Messages
1
I have two tables (tblzipcodes, and tbluwguidelines)that have a relationship via a common field name (UWID). I have another table (tblcountyandzip) that containes all of the zip codes and corresponding counties.

What I am trying to do is if a new entry is created in tbluwguidelines (new UWID) and that entry does not have all of the current zip codes (from tblcountyandzip) assigned to it in tblzipcodes (matching UWID) that the zipcodes (new entry)will be created in tblzipcodes.

So basically after a new entry is created in tbluwguidelines all of the coresponding zip codes will also be created in tblzipcodes.

UWID is the primary key in tbluwguidelines and tblzipcodes has its own primary id (zipid)

I know this is not 100% detail of what I am trying to accomplish but I am not sure what else would need to be described.

That would work if there was a zip code in tbluwguidelines, however i am only using the zipcode in the tables tblzipcodes and tblcountyandzip. So i guess i dont understand where you say capture the zip code from unless you are refering to the master zip code list.

I guess a better explanation might be that if a new record is created in tbluwguidelines then I need to check and see if the entries in tblzipcode have every zip code from tblcountyandzip for the new entry (UWID) and if not create a new entry in tblzipcode for each zipcode not in the table already.

The fields in tblcountyandzip are:
zipcode
county

the fields in tblzipcodes are :
zipid
companyid (combo box lookup from another table)
zipcode
county
open
UWID

the fields in tbluwguidelines are:
UWID
as well as several others that have no relevance.

So if a new entry into tbluwguidelines is created what i am trying to accomplish is to create new entries in tblzipcodes for each zipcode in tblcountyandzip where
zipid is primary key and created automatically
companyid is assigned from the form
zipcode is entered from tblcountyandzip (each entry (zipcode) in this table would be a new zipid)
county is copied from tblcountyandzip
open is just a simple yes/no defaulted to no
UWID is from the newly created record in tbluwguidelines

Hope this is more clear.


Thanks in advance for any help.
 

Users who are viewing this thread

Top Bottom