Hi,
Im having some trouble with code i have created for an append query.
I have no idea why, but im getting the error above. To me the query statement looks fine but im sure its something really silly i have missed out.
Please help!!
Im having some trouble with code i have created for an append query.
I have no idea why, but im getting the error above. To me the query statement looks fine but im sure its something really silly i have missed out.
Please help!!
Code:
Dim zCo As String
Dim zLine As String
Dim zSQL As String
If IsNull(Me!txtCompany) Then
MsgBox "You must enter the company name you intend to update!!"
Exit Sub
End If
If IsNull(Me!txtNominal) Then
MsgBox "You need to enter the nominal details before you continue!!"
Exit Sub
End If
zCo = "qap" & Replace(Me![txtCompany], "'", "''") & "SGA1"
zLine = Replace(Me![txtNominal], "'", "''")
zSQL = "INSERT INTO TEMP_SGA_CM ( [Company], [Our_Reference], [Year], [Period], [Cost_Centre], [Reference], [Transaction_Date], [Description], [Job_Code], [GL_Code], [Department_Code], [Value], [Rate], [Net_Value], [STG], [Department], [GL_Group], [Description_GL], [Description_CC]) " & _
"SELECT [Company], [idxOurRef1], [thYear], [thPeriod], [tlCostCentre], [thAcCode], [tlTransDate], [tlDescr], [tlJobCode], [tlGLCode], [tlDepartment], [value], [xRate], [NetValue], [Stg], [Desc], [GL_Group], [Description_GL], [Description] " & _
"FROM " & qCo & _
" WHERE [idxOurRef1] = '" & zLine & "'"
CurrentDb.Execute zSQL, DB_FAILONERROR
MsgBox "Line item for Company has been updated"