B
bill
I'm trying to convert an append query into a VBA
module...The SQL statement in the following piece of code
is taken directly from an Access append query. This
query runs without incident in Access, but when I try to
run it in VBA I get the following error:
"Undefined function ORDER_DETAIL_UPDATE.ORDER_NUMBER
WHERE in expression"
Here is the code:
Option Compare Database
Function OrderUpdateSQL2()
Dim db As Database, qdf As QueryDef, strSQL As String
strSQL = "INSERT INTO ORDER_DETAIL_UPDATE ( ORDER_NUMBER,
ITEMNO, FirstOfITEM_DESC, 0, 2, 3, 4, 5, 6, 7, 8, 9 )" & _
"SELECT qryORDER_DET_CONVERT.ORDER_NUMBER,
qryORDER_DET_CONVERT.ITEMNO,
qryORDER_DET_CONVERT.FirstOfITEM_DESC,
qryORDER_DET_CONVERT.[0], qryORDER_DET_CONVERT.[2],
qryORDER_DET_CONVERT.[3], qryORDER_DET_CONVERT.[4],
qryORDER_DET_CONVERT.[5], qryORDER_DET_CONVERT.[6],
qryORDER_DET_CONVERT.[7], qryORDER_DET_CONVERT.[8],
qryORDER_DET_CONVERT.[9]" & _
"FROM qryORDER_DET_CONVERT LEFT JOIN
ORDER_DETAIL_UPDATE ON qryORDER_DET_CONVERT.ORDER_NUMBER
= ORDER_DETAIL_UPDATE.ORDER_NUMBER" & _
"WHERE (((ORDER_DETAIL_UPDATE.ORDER_NUMBER)
Is Null))"
Set db = CurrentDb
Set qdf = db.CreateQueryDef("")
qdf.SQL = strSQL
qdf.Execute dbFailOnError
DoCmd.Quit
End Function
Any Ideas?
module...The SQL statement in the following piece of code
is taken directly from an Access append query. This
query runs without incident in Access, but when I try to
run it in VBA I get the following error:
"Undefined function ORDER_DETAIL_UPDATE.ORDER_NUMBER
WHERE in expression"
Here is the code:
Option Compare Database
Function OrderUpdateSQL2()
Dim db As Database, qdf As QueryDef, strSQL As String
strSQL = "INSERT INTO ORDER_DETAIL_UPDATE ( ORDER_NUMBER,
ITEMNO, FirstOfITEM_DESC, 0, 2, 3, 4, 5, 6, 7, 8, 9 )" & _
"SELECT qryORDER_DET_CONVERT.ORDER_NUMBER,
qryORDER_DET_CONVERT.ITEMNO,
qryORDER_DET_CONVERT.FirstOfITEM_DESC,
qryORDER_DET_CONVERT.[0], qryORDER_DET_CONVERT.[2],
qryORDER_DET_CONVERT.[3], qryORDER_DET_CONVERT.[4],
qryORDER_DET_CONVERT.[5], qryORDER_DET_CONVERT.[6],
qryORDER_DET_CONVERT.[7], qryORDER_DET_CONVERT.[8],
qryORDER_DET_CONVERT.[9]" & _
"FROM qryORDER_DET_CONVERT LEFT JOIN
ORDER_DETAIL_UPDATE ON qryORDER_DET_CONVERT.ORDER_NUMBER
= ORDER_DETAIL_UPDATE.ORDER_NUMBER" & _
"WHERE (((ORDER_DETAIL_UPDATE.ORDER_NUMBER)
Is Null))"
Set db = CurrentDb
Set qdf = db.CreateQueryDef("")
qdf.SQL = strSQL
qdf.Execute dbFailOnError
DoCmd.Quit
End Function
Any Ideas?