using INSERT INTO when datas are not on DataBase

G

Guest

hello all
I have a main form named: FormToUpdate and there I have to subForm

first subform name is:Work_Order_Dispatch_Report_ExcelDB and it's connected
to one query named:WODRQ

second subform name is:IDVolatilDBID_lbl_SubForm and its source is a table
named:IDVolatilDBID_lbl

in query:WODRQ I have fields like:
Part ID,Desc,Planner,WO ID,NoM,C-Date,S-Date

and on table:IDVolatilDBID_lbl I have fields like:
IDVolatilDateID =autonumber
Part ID,Desc,Planner,WO ID,No,C-Date,S-Date

in Main Form I have put a Button where I want to run a SQL INSERT INTO
IDVolatilDBID_lbl all fields
from query WODRQ where field Planner is not recorded in IDVolatilDBID_lbl

could you help with the statements, mine does not work

Thanks


Lorenzo Díaz
Cad Technician
 
G

Guest

Try this:

INSERT INTO IDVolatilDBID_lbl
([Part ID],Desc,Planner,[WO ID],NoM,[C-Date],[S-Date])
SELECT [Part ID],Desc,Planner,[WO ID],NoM,[C-Date],[S-Date]
FROM WODRQ
WHERE NOT EXISTS
(SELECT *
FROM IDVolatilDBID_lbl
WHERE IDVolatilDBID_lbl.Planner = WODRQ.Planner);

Ken Sheridan
Stafford, England
 

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