I would comment out the Execute until you have the syntax correct? That is how I tend to do it. Use a ' at the start of the line. ? is shortcut to output/print the result of the statement
? Date()
The Debug.Print will output to the Immediate Widow (Ctrl + G). In that window you can type in ? Me.WhateverThe NameOfTheControl is on the form (if the form is open)
Also good for just testing simple things like DLookUp() and getting the syntax correct again.
I believe Micron means
Code:
strInsert = "INSERT INTO TblItemCart(ID,[Product Code],[Amt In Stock])" & _
" SELECT ID,[Product Code],[Amt In Stock]" & _
" FROM ABCOutdoor_ProductList" & _
" WHERE ID = " & ABCOutdoor_ProductList.Form.txtID
Some people put the space at the end
Code:
strInsert = "INSERT INTO TblItemCart(ID,[Product Code],[Amt In Stock]) " & _
"SELECT ID,[Product Code],[Amt In Stock] " & _
"FROM ABCOutdoor_ProductList " & _
"WHERE ID = " & ABCOutdoor_ProductList.Form.txtID
and whilst it does not make much difference here in this code, when you have a humongous sql statement, you need to scroll to the right to see if a space exists.
Putting it at the front negates that scrolling?
I also prefer at the beginning.
HTH
Edit: The link in my signature shows how to debug Access.? I haven't put it there just because I like links?
One of the videos when you get there is this https://www.youtube.com/watch?v=7LQ1l6jdN2Q