Hello, i have very little knowledge of vba, still there should be a solution
my DB was working everything good modules etc
After splitting front end command which calls this module
Does not work error 3219 (invalid operation)
opening vba editor there is highlighted:
Set rs = CurrentDb.OpenRecordset("InitScheduletbl", dbOpenTable)
what is wrong?
my DB was working everything good modules etc
After splitting front end command which calls this module
Code:
Public Function fncNextShift(ByVal dte2 As Variant, ByVal teamID As Long) As String
Static rs As DAO.Recordset
Dim i As Date, j As Long
Dim d1 As Date, d2 As Date
Dim cnt As Long, incr As Integer
If (rs Is Nothing) Then
Set rs = CurrentDb.OpenRecordset("InitScheduletbl", dbOpenTable)
rs.Index = "teamID"
End If
incr = 1
With rs
.MoveFirst
d1 = rs("DateParam")
If IsDate(dte2) = False Or dte2 = d1 Then
Else
d2 = dte2
If d1 > dte2 Then
incr = -1
End If
For i = d1 + incr To d2 Step incr
'If InStr("/sat/sun/", Format$(i, "/ddd/")) <> 0 Then
'Else
teamID = teamID + incr
If teamID > 5 Then
teamID = 1
Else
If teamID < 1 Then
teamID = 5
End If
End If
'End If
Next
End If
.Seek "=", teamID
fncNextShift = rs("shift")
End With
End Function
Does not work error 3219 (invalid operation)
opening vba editor there is highlighted:
Set rs = CurrentDb.OpenRecordset("InitScheduletbl", dbOpenTable)
what is wrong?