Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Append Query Problem

Status
Not open for further replies.

greymonkey

Technical User
Jul 20, 2003
29
AU
hi there,

i have an append query:

INSERT INTO TblDayChildLink ( ChildRef, [Date], Book1, Book2, Book3 )
SELECT QryAddRegChild.ChildRefNum, #9/29/2003# AS Expr1, TblChildInfo.MonBreakBook AS Expr2, TblChildInfo.MonAfterBook AS Expr3, TblChildInfo.MonOtherInfo AS Expr4
FROM QryAddRegChild;



running off a select query:

SELECT TblChildInfo.ChildRefNum, TblChildInfo.[First Name], TblChildInfo.[Last Name], TblChildInfo.MonBreakBook, TblChildInfo.MonAfterBook, TblChildInfo.MonOtherInfo
FROM TblChildInfo
WHERE (((IIf([monbreakbook] Is Not Null Or [monotherinfo] Is Not Null Or [monafterbook] Is Not Null,1,0))=1));



the problem i have is that i only need to insert the data if there is not allready a row with the childRef AND Date in the table.

any ideas,

 
Hi

Is the primary key of tblDayChildLink ChildREf and Date ?

If yes it will not insert a duplicate anyway, just supress teh error message

Another point Date is a reserved word, you should not use reserved words as column names in tables (or variable names), it will end in tears

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top