Link to home
Start Free TrialLog in
Avatar of Derek Brown
Derek BrownFlag for United Kingdom of Great Britain and Northern Ireland

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
ASKER CERTIFIED SOLUTION
Avatar of Anders Ebro (Microsoft MVP)
Anders Ebro (Microsoft MVP)
Flag of Denmark image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
to clarify Anders comment,

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
Avatar of Derek Brown

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?
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