Appending missing linked records before running append and update queries

seestevecode

New member
Local time
Today, 17:05
Joined
Apr 19, 2008
Messages
7
Hi. Firstly, I hope this is the right forum. I wasn't sure if this was a Query issue or something more general.

I'm trying to update tables in my DB using temporary tables which have been imported from Excel. I have set up Unmatched and Duplicate queries and then Append and Update queries for those. So far so good.

Where I fall down is where there are entries in a field in the temp table which don't exist in a table related to the source table. I'll try and outline this.

Temp table: TDate, TCentre, TLogin, TField1, ... (no PK) <--- SOURCE

Staff table: SID [PK][anm], SFirstName, SLastName, ...
Centre table: CID [PK][anm], CCode
StaffDetails table: SDID [PK][anm], SID [FK], SDStartDate, SDEndDate, CID [FK]
StaffLogin table: SLID [PK][anm], SID [FK], SLStartDate, SLEndDate, SLNumber
StaffLoginTelephony table: SLTID [PK][anm], SLTDate, SLID [FK], SLTField1, ... <---- DESTINATION

So when there is a Temp.TLogin which doesn't exist in StaffLogin.SLNumber, I want to be able to fill in the missing details in SL table to create new records.

I have created an Unmatched query to find all entries in Temp without matching StaffLogin, but get stuck from there.

I want to show the login number and the centre from the Temp table, and then be able to append new records to the StaffLogin table with these criteria:
SID - chosen from Staff table (the name of the person)
SLStartDate - default to TDate, but allow manual change
SLEndDate - default to Null, but allow change
SLNumber - default to TLogin, don't allow change

When these new records have been appended to the StaffLogin table, I should be able to run the Append and Update queries as normal.

I hope this makes sense. Thanks for any input.
 

Users who are viewing this thread

Back
Top Bottom