time - Add one hour to Access table field, and save the value in another field -
I have a table ("booking") with the field [StartHour] (I get a value from a form) . I want to automatically update the value of another table field ([Andher]) with the value [StartHour] + 1hour how can I do this?
I find some VBA (I think) solution, but I do not think I can use VBA here. I'm talking about
= date ("H", 1, [YourField])
The code below has not been tested and is unable to write it from the top of my head, so there may be some problems, but if you have it in the VBA editor If you add it, anybody will see it
You need a Microsoft DAO reference library which is broken in the Tools & gt; Reference
Open both tables in the archive, then edit it Add the last field record Add 1 hour to the first hour of the first table, then save it in the area of the last hour.
dao.recordset dim tbl2 as dao.recordset tbl1 = currentdb.openrecordset ("table1") tbl2 = currentdb.openrecordset ("table2") with tbl2. Edit.fields ("endHour") = dateadd ("h", 1, tbl1 ("initial hours")) set tbl1 = nothing set tbl2 = nothing
Comments
Post a Comment