I am having problems with the code below.
Dim db As Database
Dim rs As Recordset
Dim tblname As String
tblname = "tblTimeClock" 'change as needed
Set db = CurrentDb
'find the master record
Set rs = db.OpenRecordset("select EmployeeID, Date, ClockIN from " &
tblname & " where EmployeeID=" & Me!txtEmployeeID, DB_OPEN_DYNASET)
If rs.EOF And rs.BOF Then
MsgBox "Master Record Deleted."
rs!Date = Me!txtDate 'match your field name
rs!ClockIN = Me!txtTime 'match your field name
I would like to use this approach to add a new record with the employee's ID, current date and current time.
Although the form has the current date (txtDate) and current time(txtTime), would I be better off doing the following?
rs!Date = Today()
rs!ClockIN = Time()