Derek Brown
asked on
sql, issue
I must be missing something here:
strSQL = _
"UPDATE ItemQuery SET ItemQuery.ItemDateCreated = Date()"
"WHERE ItemNumber=" & ItemNumber7
CurrentDb.Execute strSQL, dbFailOnError
The ItemNumber7 is a field name on the current form
The Where Clause is highlighted in Red in the code window. I guess I have a comma missing somewhere
strSQL = _
"UPDATE ItemQuery SET ItemQuery.ItemDateCreated = Date()"
"WHERE ItemNumber=" & ItemNumber7
CurrentDb.Execute strSQL, dbFailOnError
The ItemNumber7 is a field name on the current form
The Where Clause is highlighted in Red in the code window. I guess I have a comma missing somewhere
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Solved
Thank you.
Just to be clear, when you atribute the solution to an expert but also indicate some else helped, How are points distributed to contributors?
Thank you.
Just to be clear, when you atribute the solution to an expert but also indicate some else helped, How are points distributed to contributors?
ASKER
I'm getting error missing two patameters with:
strSQL = _
"UPDATE ItemQuery SET ItemQuery.ItemDateCreated = Date()" & _
" WHERE ItemNumber=" & ItemNumber7
CurrentDb.Execute strSQL, dbFailOnError
Can't see it
strSQL = _
"UPDATE ItemQuery SET ItemQuery.ItemDateCreated = Date()" & _
" WHERE ItemNumber=" & ItemNumber7
CurrentDb.Execute strSQL, dbFailOnError
Can't see it
Whenever you wrap a line of code to the next line, you must use the underscore ( _ ) as the final character in the line, which you did for line 1, and an ampersand to merge the two lines of code. And when you merge two lines of code you need to make sure there is a space between the word that ends the first line and the word that begins the second line. Otherwise:
Date() WHERE
becomes
Date()WHERE
which would generate an error at run time
HTH
Dale