I have this code:
If (((STD - FD) >= 30) And D15 >= 15) Then 'EMPLOYED MORE THAN 30 DAYS, GETS EXTRA DAY
If JOBID = 20 Then 'STAT HOLIDAY FOR COOKS/KITCHEN STAFF
DR = 1
WTYPE = "S/T"
sSQL = "SELECT ([WHRS]) From WHOURS Where [EMPID]=" & EMPID & " AND [WDATE]=""" & STD & """ AND [WTYPE]=""" & WTYPE & """;"
Set rst3 = New ADODB.Recordset
rst3.Open sSQL, objAccessConnection, adOpenKeyset, adLockOptimistic
If rst3.RecordCount = 0 Then
sSQL = "INSERT INTO WHOURS (EMPID, WDATE, WTYPE, WHRS, PCODE, WRATE, WEEKN, PAYPER) VALUES ('" & EMPID & "', '" & STD & "', '" & WTYPE & "', '" & DR & "', '" & JOBID & "', '" & RATE & "', '" & WNUM & "', '" & PPID & "'); "
Set rsAccess = New ADODB.Recordset
rsAccess.CursorLocation = adUseClient
rsAccess.Open sSQL, objAccessConnection, adOpenKeyset, adLockOptimistic, adCmdText
End If
End If
End If
but it is giving me the above error message.
This code supposes to check if an employee doesn't already have statutory holiday for the same date to avoid double entry.
I tried to change adOpenKeyset to adOpenDynamic but no difference.
Any help please?
If (((STD - FD) >= 30) And D15 >= 15) Then 'EMPLOYED MORE THAN 30 DAYS, GETS EXTRA DAY
If JOBID = 20 Then 'STAT HOLIDAY FOR COOKS/KITCHEN STAFF
DR = 1
WTYPE = "S/T"
sSQL = "SELECT ([WHRS]) From WHOURS Where [EMPID]=" & EMPID & " AND [WDATE]=""" & STD & """ AND [WTYPE]=""" & WTYPE & """;"
Set rst3 = New ADODB.Recordset
rst3.Open sSQL, objAccessConnection, adOpenKeyset, adLockOptimistic
If rst3.RecordCount = 0 Then
sSQL = "INSERT INTO WHOURS (EMPID, WDATE, WTYPE, WHRS, PCODE, WRATE, WEEKN, PAYPER) VALUES ('" & EMPID & "', '" & STD & "', '" & WTYPE & "', '" & DR & "', '" & JOBID & "', '" & RATE & "', '" & WNUM & "', '" & PPID & "'); "
Set rsAccess = New ADODB.Recordset
rsAccess.CursorLocation = adUseClient
rsAccess.Open sSQL, objAccessConnection, adOpenKeyset, adLockOptimistic, adCmdText
End If
End If
End If
but it is giving me the above error message.
This code supposes to check if an employee doesn't already have statutory holiday for the same date to avoid double entry.
I tried to change adOpenKeyset to adOpenDynamic but no difference.
Any help please?