select record on base of date and integer type

  • Thread starter gurusamy sekar via AccessMonster.com
  • Start date
G

gurusamy sekar via AccessMonster.com

Hi all..
i got a datatype mismatch criteria expression...for the following code.i
want to update the record on the base of date datatype and integer
datatype..
Here is my code..

Qry = "update employee set timeout='" & Format(Now, "h:m:s AMPM") & _
"' where todate= '" & dat & "' and empno = " & TxtEmpId.Text
db.Execute (Qry)

todate is date data type
empno is integer..

plz any one send me how to recover this error...
 
A

Andreas

Not sure on this.

What data type is timeout?
If DateTime, then use # instead of ' (have done this below).

What is dat?
Do you mean the Date() function? If not you also need the # (have done
this below)

Qry = "update employee set timeout=#" & Format(Now, "h:m:s AMPM") & _
"# where todate= #" & dat & "# and empno = " & TxtEmpId.Text

Regards,
Andreas
 
B

Brendan Reynolds

That would be "todate = #" & dat & "# etc."

The delimiter for dates in Jet SQL is the # symbol rather than a quote.
 
V

Van T. Dinh

I am not sure of your Regional Settings for Date / Time so I suggest the
general method:

Qry = "UPDATE employee SET timeout = " & _
Format(Now, "\#HH:nn:ss\#") & _
" WHERE todate= " & Format(dat, "\#mm/dd/yyyy\#") & _
" AND empno = " & TxtEmpId.Text
 
G

gurusamy sekar via AccessMonster.com

Thanks to all ...
it is really working good.....
thank u very much....
 
Top