Richie2837
Registered User.
- Local time
- Today, 21:22
- Joined
- Jan 30, 2007
- Messages
- 88
I have a command button on my contacts form to enable editing to be switched on (it opens non-editable). This works fine, but I have a sub-form to record all call history for individuals, and this remains locked despite clicking the Edit command button.
The code behind the button is this:
Private Sub cmdEdit_Click()
Forms!Contacts.Form.Call History.AllowEdits = True
If Me.AllowEdits And Me.Dirty Then
Me.Dirty = False ' save record
End If
Me.AllowEdits = Not Me.AllowEdits ' toggle setting
' change the button's caption
cmdEdit.Caption = IIf(Me.AllowEdits, "Restrict Edits", "Edit Record")
End Sub
' always start with no editing allowed as each record is visited
Private Sub Form_Current()
Me.AllowEdits = False
cmdEdit.Caption = "Edit Record"
End Sub
But whenever I click the Edit command button I get a Runtime Error 424 - Object Required message.
Does anyone have any ideas what I've done wrong?
The code behind the button is this:
Private Sub cmdEdit_Click()
Forms!Contacts.Form.Call History.AllowEdits = True
If Me.AllowEdits And Me.Dirty Then
Me.Dirty = False ' save record
End If
Me.AllowEdits = Not Me.AllowEdits ' toggle setting
' change the button's caption
cmdEdit.Caption = IIf(Me.AllowEdits, "Restrict Edits", "Edit Record")
End Sub
' always start with no editing allowed as each record is visited
Private Sub Form_Current()
Me.AllowEdits = False
cmdEdit.Caption = "Edit Record"
End Sub
But whenever I click the Edit command button I get a Runtime Error 424 - Object Required message.
Does anyone have any ideas what I've done wrong?