Import query in code

  • Thread starter Thread starter Dale
  • Start date Start date
D

Dale

I want to import data from one database to another. I have the following
query that will import all the data that i need. I am not sure how to modify
this query to only import data that does not already exist in the table. Any
suggestions?

sql = "Insert into classinfo (showid,classid,classnumber,classdescription)
"SELECT ClassInfo.ShowID, ClassInfo.ClassID, ClassInfo.ClassNumber,
ClassInfo.ClassDescription FROM (ActiveShow INNER JOIN ClassInfo ON
ActiveShow.ShowID = ClassInfo.ShowID) where ClassInfo.SeparateScoring = True
in '" & Text1.Value & "'"
CurrentDb.Execute (sql)
 
If you have a primary key or unique index defined on the table, Jet will
discard duplicates with an error warning that you can ignore. If you don't
have a PK or unique index, how would you identify a duplicate?
 
Back
Top