Edit Command Button

Richie2837

Registered User.
Local time
Today, 11:29
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?
 
This looks wrong...
Richie2837 said:
Forms!Contacts.Form.Call History.AllowEdits = True
Try...
Code:
Forms!Contacts.Form.[Call History].AllowEdits = True
 
Hi Lagbolt,

Thanks for the input but I'm afraid it isn't working.

It now returns the error code 438 "Object doesn't support this property or method".

Any ideas what else I could try?
 
Try this

Sure it's working. It's called debugging...
Code:
Forms!Contacts.[Call History].Form.AllowEdits = True
 
Last edited:
Sorry, but I'm a novice at this and don't know what I need to do when I get this error message.

Can anyone help me?
 
Last edited:

Users who are viewing this thread

Back
Top Bottom