Subform Enabled / disabled

smtazulislam

Member
Local time
Tomorrow, 01:06
Joined
Mar 27, 2020
Messages
808
Hi,
I have a parent form what name is "frmEmployeeEdit". In the form have Tab Control 8 pages.
Some pages have Subform and some pages have Continuous Forms.
Exp:
One page name is "EmployeeIdentity_Page" and this page subform name is "PassportSubform"
Two page name is "Facility_Page" and this page Continuous Form name is "FacilitiesSubformEdit"
I try:
Code:
Forms![frmEmployeeEdit]![PassportSubform].EnableD = False
And next try:
Code:
Forms![frmEmployeeEdit]![PassportSubform].Visible= False
it is work, but I dont want to hide fields. Showed and should be gray colors.

I want to enable and disabled Subform fields and Continuous Form fields ?
Thanks and any help will appreciated.
 
you can passed a (0 or False) to these form property:
AllowAdditions
AllowEdits
AllowDeletions


Code:
    With [Forms]![frmEmployeeEdit]![PassportSubform].Form
        .AllowAdditions = False
        .AllowEdits = False
        .AllowDeletions = False
    End With

or simply
Code:
Forms![frmEmployeeEdit]![PassportSubform].Form.Enabled = False
 
think you will need multiple lines, one for each control on the subform - or use a loop in some way. To reference a control on a subform you would have something like

Forms![frmEmployeeEdit]![PassportSubform].form.mycontrol.Enabled = False
 
Thank you so much for reply.
Actually I have a function DisbaleData and EnabledData
I try Disabled Data
Code:
Private Sub DisabledData()
    'Facility
    Me.FacilitiesSubformEdit.EnableD = False

    'Page
'    Me.PassportSubform.EnableD = False
    With [Forms]![frmEmployeeEdit]![PassportSubform].Form
        .AllowAdditions = False
        .AllowEdits = False
    End With
'try it also
    'Forms![frmEmployeeEdit]![PassportSubform].Form.EnableD = False
'try it also
    'Forms![frmEmployeeEdit]![PassportSubform].Form.TabCtlEdit.EnableD = False
    
End Sub
I try Enabled Data
Code:
Private Sub EnableData()
    'Facility
    Me.FacilitiesSubformedit.EnableD = True
    
    'Page
    With [Forms]![frmEmployeeEdit]![PassportSubform].Form
       .AllowAdditions = True
        .AllowEdits = True
    End With
'try it also
'    Forms![frmEmployeeEdit]![PassportSubform].Form.TabCtlEdit.EnableD = True
'try it also
'    Me.PassportSubform.Form.CommandEnabled = True
End Sub
But in this Subform can visible all field. And looking
 
I use this on my main form when I want to prevent editing of a Sub form

Me.SubFormName.Form.AllowEdits = False
 
I use this on my main form when I want to prevent editing of a Sub form

Me.SubFormName.Form.AllowEdits = False
Thank you so much Mick
Not work... And not error.
I can visible all fields after code.
 
Thank you so much Mick
Not work... And not error.
I can visible all fields after code.
You asked for enable/disable originally?

Now you are asking for visible/hidden ?
 
You asked for enable/disable originally?

Now you are asking for visible/hidden ?
oh No, I think you misunderstood me.
I wrote what I found there. All of the fill is hidden. But i dont like to hide these fields.
1604306177091.png

Please look this screenshot Form, "Passport Details" fields can insert curser. And white color.
I wanting subform fields are enabled and grayed color.
Hope you understand me what I looking.
Thank you.
 
What is wrong with CJ_London's solution in post #3?
How have you disabled the controls on the bottom of that form?
 
How have you disabled the controls on the bottom of that form?
Thank you so much for reply

me.fieldName.enabled = false
Because it is the form fields. Top all of the field is a subform. And I looking SubForm and Continuous form.
Post #3:
I try
Forms![frmEmployeeEdit]![PassportSubform].Form.TabCtlEdit.EnableD = False
Not work.
 
So do the same for the other controls? the actual data entry controls, not all the tabs and pages.?
 

Users who are viewing this thread

Back
Top Bottom