L
Leanne Everingham
I am trying to run multiple append queries using SQL to change the field names required for each value in my records. I am in the progress of appending the field name as a value in a table and then will use a while loop to insert the field name into a types column of the receiving table. I am not sure what is wrong with my syntax, my code is as follows:
Option Compare Database
Option Explicit
Private Sub Form_Load()
On Error GoTo err_Handler
Dim MyDB As Database, rs As Recordset
Dim fldName As String
Set MyDB = CurrentDb
DoCmd.SetWarnings False
fldName = "Solids"
DoCmd.RunSQL ("INSERT INTO tmpSampleReport ( [DateTime], [Sample Point], Val, Area )" & _
"SELECT SampleDataCollect.DateTime, SampleDataCollect.SamplePointName, SampleDataCollect." & fldName & ", 'The missing operator is somewhere here:
Area.AreaName" & _
"FROM SampleDataCollect INNER JOIN Area ON SampleDataCollect.AreaID = Area.AreaID" & _
"WHERE ((SampleDataCollect.DateTime)>DateAdd(7,-1,Date()) AND (SampleDataCollect." & fldName & ") Is Not Null;")
EggHeadCafe - Software Developer Portal of Choice
WCF Workflow Services Using External Data Exchange
http://www.eggheadcafe.com/tutorial...a-6dafb17b6d74/wcf-workflow-services-usi.aspx
Option Compare Database
Option Explicit
Private Sub Form_Load()
On Error GoTo err_Handler
Dim MyDB As Database, rs As Recordset
Dim fldName As String
Set MyDB = CurrentDb
DoCmd.SetWarnings False
fldName = "Solids"
DoCmd.RunSQL ("INSERT INTO tmpSampleReport ( [DateTime], [Sample Point], Val, Area )" & _
"SELECT SampleDataCollect.DateTime, SampleDataCollect.SamplePointName, SampleDataCollect." & fldName & ", 'The missing operator is somewhere here:
Area.AreaName" & _
"FROM SampleDataCollect INNER JOIN Area ON SampleDataCollect.AreaID = Area.AreaID" & _
"WHERE ((SampleDataCollect.DateTime)>DateAdd(7,-1,Date()) AND (SampleDataCollect." & fldName & ") Is Not Null;")
EggHeadCafe - Software Developer Portal of Choice
WCF Workflow Services Using External Data Exchange
http://www.eggheadcafe.com/tutorial...a-6dafb17b6d74/wcf-workflow-services-usi.aspx