Wappervliegje
Registered User.
- Local time
- Today, 23:58
- Joined
- Nov 11, 2014
- Messages
- 23
Dear people,
I hope that you can help me with my problem. I have made a code (see below) to run a code for all subforms. But I get always "Run-time error 424, Object required". I don't know why this code can find no one of all subforms? I thought that if I change this "With SubForm(Sequence)" into "With "." & SubForm(Sequence)", this problem is then going. But no result...
With kindly regards! Wappervliegje!
I hope that you can help me with my problem. I have made a code (see below) to run a code for all subforms. But I get always "Run-time error 424, Object required". I don't know why this code can find no one of all subforms? I thought that if I change this "With SubForm(Sequence)" into "With "." & SubForm(Sequence)", this problem is then going. But no result...
Code:
Private Sub Form_Current()
Dim DLookUpSID As String
Dim SubForm As Variant
Dim Sequence As Long
DLookUpSID = DLookup("Security_ID", "tbl_Security_Level", "[Security_ID]=" & _
Nz(DLookup("User_Security_ID", "tbl_Users", "[User_Name]='" & VBA.Environ("USERNAME") & "'"), "6") & "")
SubForm = Array( _
".fsub_Bestellingen", _
".fsub_Uitvullen", _
".fsub_Titratie", _
".fsub_Verlopen_Antilichamen", _
".fsub_Status_Bestellingen", _
".fsub_Panels")
With Me
If DLookUpSID <= 2 Then
For Sequence = 0 To 3
With SubForm(Sequence)
.Locked = False
.Form.cmd_Add.Enabled = True
.Form.cmd_Undo.Enabled = True
.Form.cmd_Remove.Enabled = True
.Form.cmd_Save.Enabled = True
End With
Next
Else
For Sequence = 0 To 3
With SubForm(Sequence)
.Locked = true
.Form.cmd_Add.Enabled = False
.Form.cmd_Undo.Enabled = False
.Form.cmd_Remove.Enabled = False
.Form.cmd_Save.Enabled = False
End With
Next
End If
End With
With kindly regards! Wappervliegje!