I import a csv file that updates existing table data or inserts it if matching data doesn't already exist. This worked perfectly for awhile, then I added three fields (Back, Forward, Exit--in response to the underlying data changing), and now I'm getting errors.
The code throwing errors:
strTest = "update tblStories INNER JOIN tblTemp2 ON format(tblTemp2.[Time Posted],'MM/dd/yyyy hh:mm:ss') = format(tblStories.[Time Posted] ,'MM/dd/yyyy hh:mm:ss') set tblStories.[Completion Rate]=tblTemp2.[Completion Rate],tblStories.[Avg Views/User]=tblTemp2.[Avg Views/User],tblStories.[Impressions]=tblTemp2.[Impressions],tblStories.[Reach]=tblTemp2.[Reach],tblStories.[Reply Count]=tblTemp2.[Reply Count],tblStories.[Back]=tblTemp2.[Back],tblStories.[Forward]=tblTemp2.[Forward],tblStories.[Exit]=tblTemp2.[Exit]"
ExecuteSQL (strTest)
strTest = "insert into tblStories ([Image URL],[Completion Rate],[Avg Views/User],[Impressions],[Reach],[Reply Count],[Back],[Forward],[Exit],[Time Posted]) SELECT tblTemp2.[Image URL],tblTemp2.[Completion Rate],tblTemp2.[Avg Views/User],tblTemp2.[Impressions],tblTemp2.[Reach],tblTemp2.[Reply Count],tblTemp2.[Back],tblTemp2.[Forward],tblTemp2.[Exit],tblTemp2.[Time Posted] FROM tblTemp2 LEFT JOIN tblStories ON format(tblTemp2.[Time Posted],'MM/dd/yyyy hh:mm:ss') = format(tblStories.[Time Posted] ,'MM/dd/yyyy hh:mm:ss') WHERE (((tblStories.[Time Posted]) Is Null))"
ExecuteSQL (strTest)
When I interrupt to print and confirm, I get the following:
update tblStories INNER JOIN tblTemp2 ON format(tblTemp2.[Time Posted],'MM/dd/yyyy hh:mm:ss') = format(tblStories.[Time Posted] ,'MM/dd/yyyy hh:mm:ss') set tblStories.[Completion Rate]=tblTemp2.[Completion Rate],tblStories.[Avg Views/User]=tblTemp2.[Avg Views/User],tblStories.[Impressions]=tblTemp2.[Impressions],tblStories.[Reach]=tblTemp2.[Reach],tblStories.[Reply Count]=tblTemp2.[Reply Count], tblStories.[Back]=tblTemp2.[Back], tblStories.[Forward]=tblTemp2.[Forward], tblStories.[Exit]=tblTemp2.[Exit]
Thoughts?
[Time Posted]field in either table? Short text or date/time? - Parfait