I cannot seem to understand why I am getting an error on my Dlookup() as well as my Append query. Syntax looks fine to me. Help will be much appreciated as I'm too frustrated to think clearly. Thanks in advance!
Dlookup()
Code:
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim rs1 As DAO.Recordset
Dim rs2 As DAO.Recordset
Dim lngEmplID As Long, dblPctException As Double, dblNumWksExempt As Double, dblNumWksExceptions As Double, i As Integer
Dim mySQL As String, strEmplID As String, strFunDesc As String
Dim dtExceptionDate As Date, dtEffStartDate As Date, dtEffEndDate As Date, dtFunDate As Date
On Error GoTo ErrorHandler
Set db = CurrentDb
strFunDesc = "funRedYelGreen"
dtFunDate = DLookup("FunDate", "tblFunctions", "[FunDesc] = '" & strFunDesc & "';")
Append Query in the same function...
Code:
ErrorHandler:
mySQL = "INSERT INTO tblErrorLog([ErrorDesc], [ErrorNumber], [FunDesc]) VALUES('" & Err.Description & "', " & Err.Number & ", '" & strFunDesc & "');"
CurrentDb.Execute mySQL
Both are giving me the error:
"Run-time error '3075': Syntax error in query expression..."