Append Query

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have and excel spreadsheet I import into a table every week. I wrote this
append query to append this table to a datasheet in access. It works except
I want to only add the new rows where there is a new router. The impRouter
is the key field. It should be in SQL NOT EQUALS TO???

query that appends all the records
INSERT INTO _HSIImport ( impArea, impHeadend, impRouter, impDate )
SELECT [Port History9_1_2007].Area, [Port History9_1_2007].Headend, [Port
History9_1_2007].[Element Name], ([#date#]) AS Expr1
FROM [Port History9_1_2007];


modified query to add only the new router records:
INSERT INTO _HSIImport ( impArea, impHeadend, impRouter, impDate )
SELECT [Port History9_1_2007].Area, [Port History9_1_2007].Headend, [Port
History9_1_2007].[Element Name] NOT EQUALTO [_HSIImport].impRouter,
([#date#]) AS Expr1
FROM [Port History9_1_2007];


I think there is a syntax error.

tia,
 
can be:

INSERT INTO _HSIImport ( impArea, impHeadend, impRouter, impDate )
SELECT Area, Headend, [Element Name], [#date#]
FROM [Port History9_1_2007]
WHERE [Element Name] NOT IN( SELECT impRouter FROM [_HSIImport] )



Alternatively, you can use an outer join.

Vanderghast, Access MVP
 
Back
Top