Les Isaacs
Registered User.
- Local time
- Today, 09:33
- Joined
- May 6, 2008
- Messages
- 186
Hi All
I have written the procedure below to lock/unlock all the fields on a form, and it all works perfectly where the form is open in datasheet view, but when the form is open in continuous form view I get "Object doesn't support this property or method" on line 110/140. I'm guessing the locked property is different for continuous forms? I'd be very grateful for any advice.
Thanks in advance.
I have written the procedure below to lock/unlock all the fields on a form, and it all works perfectly where the form is open in datasheet view, but when the form is open in continuous form view I get "Object doesn't support this property or method" on line 110/140. I'm guessing the locked property is different for continuous forms? I'd be very grateful for any advice.
Thanks in advance.
Code:
Public Sub LockControls(SetLocked As Boolean, frm As Form)
Dim ctl As control
Dim strPassword As String, strConfirmation As String
10 On Error GoTo LockControls_Error
20 If SetLocked = False Then
30 strPassword = InputBox("If you want to edit the system parameters, enter the management password below.")
40 If strPassword <> "justdoit" Then
50 MsgBox ("You have not entered the correct management password!")
60 Exit Sub
70 End If
80 End If
90 For Each ctl In frm.Controls
100 If SetLocked = False And strPassword = "justdoit" Then
110 ctl.Locked = False
120 strConfirmation = "The table is now unlocked: be careful!"
130 Else
140 ctl.Locked = True
150 strConfirmation = "The table is now locked!"
160 End If
170 Next
180 MsgBox (strConfirmation)
190 Set frm = Nothing
200 On Error GoTo 0
210 Exit Sub
LockControls_Error:
220 Call WriteErrors(Erl, Err.number, Err.Description, "LockControls", "Module", "modUtils")
End Sub