none
Enable control on another form based on a checkbox selection in another form. RRS feed

  • Question

  • Hello,

    I am trying to enable a control based on the checkbox selection from another form.  For example. If I click on a checkbox called - "Additional Training Required?", a drop menu called Additional Training on another form will be enabled when the form it resides on opens.  Will I make a reference to the control on the After update event of the Checkbox,? If so, Can anyone please help me with a  syntax of how I make a reference to the Control in question.? 

    Thanks in Advance...


    olu Solaru

    Thursday, July 18, 2019 3:55 PM

Answers

  • defining 'drop menu called Additional Training on another form' as being Form2

    then your trigger is in the OnCurrent event of Form2

    the code would look for the value of the checkbox in whatever table/record that is found - - or if you are 100% sure the form itself will always be opened then it can look for the form.

    based on that - then one toggles the Form2 control's enabled property on/off

    note that this state will be maintained - which is probably not wanted so you'll first clear it then activate it:

    me.ControlName.enabled = false

    if [where ever & how ever you are looking] = -1 then

    me.ControlName.enabled = true

    end if

    • Marked as answer by osolaru71 Thursday, July 18, 2019 8:49 PM
    Thursday, July 18, 2019 8:06 PM

All replies

  • defining 'drop menu called Additional Training on another form' as being Form2

    then your trigger is in the OnCurrent event of Form2

    the code would look for the value of the checkbox in whatever table/record that is found - - or if you are 100% sure the form itself will always be opened then it can look for the form.

    based on that - then one toggles the Form2 control's enabled property on/off

    note that this state will be maintained - which is probably not wanted so you'll first clear it then activate it:

    me.ControlName.enabled = false

    if [where ever & how ever you are looking] = -1 then

    me.ControlName.enabled = true

    end if

    • Marked as answer by osolaru71 Thursday, July 18, 2019 8:49 PM
    Thursday, July 18, 2019 8:06 PM
  • You can only enable or disable a control on a form if the form is open or it is a SubForm of another form. Make the form with the "Additional Training" dropdown control a Subform of the form with the "Additional Training Required" checkbox control. Then you can edit both forms and enable or disable the "Additional Training" dropdown control on the SubForm. Use the following VBA in the "Additional Training Required" On Click Event:

    If Me.Additional Training Required= -1 Then

    Me.SubFormName.AdditionalTraining.Enabled=True

    Else

    Me.SubFormName.AdditionalTraining.Enabled=False

    End If

    Thursday, July 18, 2019 10:36 PM