Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DoCmd UPDATE , Problem with where criteria 1

Status
Not open for further replies.

DemonHub

Programmer
Jul 26, 2005
7
CA
I need help with this code

DoCmd.RunSQL "UPDATE CocheDivers SET Diver1 =" & div1 & ", Diver2=" & div2 & _
", Diver3=" & div3 & ", Diver4=" & div4 & _
" WHERE NumDossier=" & "'" & Me!NumDossier & "'" & _
" AND Critere=" & "'" & Me!Criteres1 & "'" & _
" AND DateRecu=" & Me!DateRecu


The criteria DateRecu is not working and I don't know how to fix the problem.
It's look like he can't compare the two dates.
 
Nop sorry that doesn't work

" AND DateRecu= date'" & Me!DateRecu & "'" <- Dont work
" AND DateRecu= date(" & Me!DateRecu & ")" <- Dont work
 
If dateRecu is a datetime field you must have #..# around the value.
If you do not have US regional settings you need to reformat your date:
" AND DateRecu=#" & format(Me!DateRecu,"yyyy-mm-dd") & "#
 
what's the extra "date" for? Where are the # signs?

" AND DateRecu= date'" & Me!DateRecu & "'"
" AND DateRecu= date(" & Me!DateRecu & ")"


Is NumDossier a Text field? There's ' marks so that would indicate text. What about Critere? is that text too?

I would also speculate that your table isn't normalized by the glaring indicators: Diver1, Diver2, Diver3, Diver4. Have you read The Fundamentals of Relational Database Design?

Leslie

Anything worth doing is a lot more difficult than it's worth - Unknown Induhvidual
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top