Update table fields to specific date

Hello1

Registered User.
Local time
Today, 18:29
Joined
May 17, 2015
Messages
271
Code:
Set MyRS = MyDB.OpenRecordset("UPDATE Bills SET Bills.DateTimeEm = #1/1/1900 1:0:0# WHERE Bills.IdBills = " & Me.IdBills & ";")

I cant get it to work in VBA. Runtime error 3219 appears, invalid operation.
Just cant figure it out how to write date to table, it should be
Code:
01.01.1900 01:00:00
 
I've never heard of opening a recordset using action sql or query. Would not think it possible.
You have to open the rs and perform the .Edit .Update methods on it (not update as in sql).
It's a common topic you can research if you want to learn the methods, but not worth the effort for this. You probably should be either running a stored query or executing the sql in code. For that you can use .Execute method of the CurrentDb object or use DoCmd.RunSql. I prefer to use the former.
 
Was late I didnt know what i was doing :D
Thanks
 
Last edited:

Users who are viewing this thread

Back
Top Bottom