Trevor G
Registered User.
- Local time
- Today, 09:34
- Joined
- Oct 1, 2009
- Messages
- 2,341
I am trying to get around creating an Append Query by using the Insert Statement in a VBA module.
This is the Query SQL that I have when I create the query in design view.
And this is what I am trying to convert it to using VBA.
This is all part of multiple applications being used, so excel, outlook and access. I have all the other things working at this time but not this code.
I get a run time error 3075 Missing Operator.
This is the Query SQL that I have when I create the query in design view.
INSERT INTO tblAbsenceRegister ( EmployeeID, AbsenceType, StartDate, EndDate, HalfDay, StartTime, FinishTime )
SELECT tblEmployeeNames.ID, tblTempImport.AbsenceType, tblTempImport.StartDate, tblTempImport.EndDate, tblTempImport.HalfDay, tblTempImport.StartTime, tblTempImport.EndTime
FROM tblTempImport LEFT JOIN tblEmployeeNames ON tblTempImport.From=tblEmployeeNames.EmployeeNames;
And this is what I am trying to convert it to using VBA.
Sub updateAbsenceType()
Dim SQL As String
DoCmd.SetWarnings False
SQL = "INSERT INTO tblAbsenceRegister (EmployeeID,AbsenceType,StartDate,EndDate,HalfDay,StartTime,FinishTime)"
SQL = SQL & "SELECT tblEmployeeNames.ID,tblTempImport.AbsenceType,tblTempImport.StartDate,tblTempImport.EndDate,tblTempImport.HalfDay, tblTempImport.StartTime,tblTempImport.EndTime"
SQL = SQL & "FROM tblTempImport LEFT JOIN tblEmployeeNames ON tblTempImport.From = tblEmployeeNames.EmployeeNames;"
DoCmd.RunSQL SQL
DoCmd.SetWarnings True
End Sub
This is all part of multiple applications being used, so excel, outlook and access. I have all the other things working at this time but not this code.
I get a run time error 3075 Missing Operator.