Edit Button to enable edits on form and subform

craigprice

Registered User.
Local time
Today, 12:08
Joined
Apr 8, 2013
Messages
44
I have a form "Handover" on this form I have a button that enables edit functionality once clicked, I now have a subform on this form named "Bdown".

The Bdown subform allows edits without having to click the "btn_Edit" on the main form "Handover".

Is is possible to make the edit button on "Handover" control the edit function on "Bdown" also?

Currently "Handover" contains:

Code:
Private Sub btn_Edit_Click()
Me.AllowEdits = True
Me.btn_Edit.Caption = "Editing"
End Sub

&

Code:
Private Sub Form_Load()
    Me.btn_Edit.Caption = "Edit Handover"
    Me.AllowEdits = False
    Application.CommandBars("Menu bar").Enabled = False
    DoCmd.Maximize
    DoCmd.GoToRecord , , acLast
    Call AccessMoveSize(0, 0, 930, 780)
    Call HideAccess
End Sub
 
This is untested
Code:
Private Sub btn_Edit_Click()
If Me.btn_Edit.Caption = "Edit Handover" Then
  Me.AllowEdits = True
  Me.Bdown.Form.AllowEdits = True
  Me.btn_Edit.Caption = "Editing"
Else
  Me.AllowEdits = False
  Me.Bdown.Form.AllowEdits = False
  Me.btn_Edit.Caption = "Edit Handover"
End Sub
Code:
Private Sub Form_Current()
    Me.btn_Edit.Caption = "Edit Handover"
    Me.AllowEdits = False
End Sub

Code:
Private Sub Form_Load()

    Application.CommandBars("Menu bar").Enabled = False
    DoCmd.Maximize
    DoCmd.GoToRecord , , acLast
    Call AccessMoveSize(0, 0, 930, 780)
    Call HideAccess
End Sub
I think it may be better to move the first two lines of code in the OnLoad event to the form's OnCurrent event as shown above.
 
A Subform resides in a Subform Control, a Control on the Main Form. If AllowEdits = No, on the Main Form, edits cannot be done to the Subform Control! And Access considers edits done on the Subform itself to be editing of the Subform Control, on the Main Form, where Edits are now verboden!

If on the Main Form, your AllowEdits = Yes, you can set AllowEdits = No on the Subform, and it'll owrk as intended, but not vice versa.

Can you strip out confidential data,if any, and attaching your file here?

Linq ;0)>
 

Users who are viewing this thread

Back
Top Bottom