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

Avatar of undefined
Last Comment
Derek Brown

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Anders Ebro (Microsoft MVP)

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Dale Fye

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

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
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck