error on update table WHERE date comparison

Joined
Dec 25, 2013
Messages
1
Reaction score
0
Hello, im having dificulties while trying to UPDATE a row in access database using VBA.

I have this code on insert button:

gen_cas.Value = Now() 'gen_cas is a field in form with date format...

CurrentDb.Execute ("INSERT INTO DB_VEHICL_CONT(sv, spz, gen_time, gen1) VALUES('" & Me.sv & "', '" & Me.spz & "', '" & Me.gen_cas & "', '" & Me.gen1 & "')")

database column gen_time is set as DATE general with (format DD.MM.YYYY HH:MM:SS)

so before insert it puts actual datetime into field - then it inserts into appropriate column within INSERT from this date field.

But when Im trying to update using

CurrentDb.Execute ("UPDATE DB_VEHICL_CONT SET kon1='" & Me.gen1 & "' WHERE gen_time='" & Me.gen_cas & "'")

an error ocures saying that there are different column types being compared - the error is on WHERE statement. when I do a WHERE some other comparison - it works pretty well but never with this DATE field.

Can anyone help with this???
Thank you in advance...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top