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