RickHunter84
Registered User.
- Local time
- Today, 18:48
- Joined
- Dec 28, 2019
- Messages
- 85
Dear friends,
I hope you are doing well.
I've been running into a syntax issue when executing a update statement on VBA.
The line in discussion:
lineStatus_FK is number (connected status tbl)
IncomingID is number (Autonumber)
IdLine is number Dim as Integer
It looks like a straight forward update line, but I continue getting the error in the picture (see attached), i have tried different syntax and the error persists.
Also, separate question, i have seen a lot of people coding the update statement in different ways where the code is added into a variable, for example:
is there any difference between doing a Currentdb.Execute and the dividing the code in smaller chunks?
Looking forward to your feedback.
thank you!
Rick
I hope you are doing well.
I've been running into a syntax issue when executing a update statement on VBA.
The line in discussion:
Code:
CurrentDb.Execute "UPDATE tblPurchaseOrderDetail SET lineStatus_FK = 2" & "WHERE [IncomingID]=" & IdLine & ";"
lineStatus_FK is number (connected status tbl)
IncomingID is number (Autonumber)
IdLine is number Dim as Integer
It looks like a straight forward update line, but I continue getting the error in the picture (see attached), i have tried different syntax and the error persists.
Also, separate question, i have seen a lot of people coding the update statement in different ways where the code is added into a variable, for example:
Code:
Dim db As DAO.Database
Dim rs As Recordset
Dim sSQL As String
Dim sSQL1 As String
Set db = CurrentDb()
Set rs = db.OpenRecordset("T05_Pr2_Null_Not_In_Rem")
sSQL = "UPDATE T05_Pr2_Null_Not_In_Rem SET SAP = NULL " & _
" WHERE (SAP = 1 AND SAG = 3)"
DoCmd.RunSQL sSQL
sSQL = "UPDATE T05_Pr2_Null_Not_In_Rem SET SAG = NULL " & _
" WHERE (SAP = 1 AND SAG = 3)"
DoCmd.RunSQL sSQL
rs.Close
Set rs = Nothing
db.Close
is there any difference between doing a Currentdb.Execute and the dividing the code in smaller chunks?
Looking forward to your feedback.
thank you!
Rick