I need to check the below table to see if the record is there using VBA when I click the button. Then run an append query if the record doesn't exist, and run an update query if the record there. Please note that I should only add a new record if both the EmployeeID and AttendanceDate do not exist.
The code that I have tried so far is this:
Code:If DLookup("EmployeeID", "AttendanceTable", "EmployeeID= '" & txtEmployeeID & "'") > 0 Then ' Run update query Else ' Run append query End If
AttendanceTable
AttendanceID AttendanceDate EmployeeID EmployeeName AttendanceCode 000001 08/08/2023 101 Adam P 000002 08/08/2023 102 Sam P 000003 08/08/2023 103 John P