Insert Date/Time Into Table Using Command Button

highwayman

New member
Local time
Today, 08:58
Joined
Sep 26, 2012
Messages
2
I have a form called 'Form' with an unbound Combo Box on it called 'Item'. There is also a select query displayed right on the form that feeds from a table called 'Table'. Each time you select a different value in the Combo Box, the query refreshes. The value in the Combo box is used as criteria in the query. For example, when the value in the Combo Box is changed to '2', the query refreshes to show all records in the table where Item equals '2'. Note that the table itself has a field in it called Item.

I want to add a command button where, On Click, it inserts the current Date/Time, i.e., =Now(), into a table field called Start Time anywhere Start Time is currently null. However, I only want to do this for records shown in the query, not for every record in the table where Start Time is null. For instance, if a record has an Item field with value '3', and the Combo Box value is '2', On Click this record would not have its Start Time updated.

I'm looking for the VBA coding for the command button. Thanks in advance to anyone who responds!
 
I'm still learning this stuff, but could you set up an update query to do this, and have your button just run the query?
 

Users who are viewing this thread

Back
Top Bottom