Code:
Set rs = OpenSeek("FormBevoegdheden")
What's OpenSeek?
You should use code tags when posting code. Makes it easier to read.
Code:
If TempVars("InUitSchakelen") Then Call modInUitSchakelen(TempVars("Shopbeheerder"), frmnm, Me.ActiveControl.Name, Me.ActiveControl.Caption)
End If
This is the code for the actual processing:
Public Sub modInUitSchakelen(InUit, frm, ctl, cap)
On Error GoTo Proc_Error
DoCmd.Hourglass True
If InUit = "xxxxxxxx" Then GoTo Proc_Exit
Dim rs As DAO.Recordset
Dim db As DAO.Database
Dim strsql As String
strsql = "SELECT * FROM FormBevoegdheden WHERE Identificatie = " & Chr(34) & InUit & Chr(34) & " ;"
Set db = CurrentDb()
Set rs = db.OpenRecordset(strsql, dbOpenDynaset)
With rs
If .RecordCount > 0 Then
.MoveFirst
Do Until .EOF
Forms(frm).Controls(ctl).BorderColor = vbRed
.MoveNext
Loop
End If
End With
rs.Close
Set rs = OpenSeek("FormBevoegdheden")
With rs
.Index = "Primarykey"
.Seek "=", frm, ctl, InUit
If .NoMatch Then
.AddNew
!Form = frm
!Control = ctl
!Identificatie = InUit
.Update
Forms(frm).Controls(ctl).BorderColor = vbRed
Else
.Delete
Forms(frm).Controls(ctl).BorderColor = vbBlack
End If
End With
Proc_Exit: On Error Resume Next
rs.Close
db.Close
Set rs = Nothing
Set db = Nothing
DoCmd.Hourglass False
Exit Sub
Proc_Error:
If Err.Number = 2220 Then
Resume Next
End If
Call errfout(Err.Number, Err.Description)
Resume Proc_Exit
End Sub