Enable/Disable on checkbox

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Will James
    New Member
    • Dec 2011
    • 11

    #1

    Enable/Disable on checkbox

    Hi there,

    I have 2 forms that I had built and added Touch Screen Keyboards to, What I would like to know is if its possible to have these enabled and disabled by using a different form with a checkbox.

    So When the checkbox on the form called 'Enable Keyboard' is checked the buttons on the other forms called 'Sign In' & 'Search' are enabled and then when the checkbox is unchecked they are disabled.

    If it is possible please could someone explain how this can be done.

    I have tried searching google but had no joy!

    Many Thanks
  • ADezii
    Recognized Expert Expert
    • Apr 2006
    • 8834

    #2
    Let's assume that:
    1. You have a Check Box on the Enable Keyboard Form named chkEnableContro ls.
    2. Form2 has 2 Command Buttons named Sign In and Search.
    3. Form3 has 2 Command Buttons named Sign In and Search.
    4. Both Form2 and Form3 have a Control (Text Box) named Text1.
    5. All 3 Forms are Opened.
    6. Execute the following Code in the AfterUpdate() Event of chkEnableContro ls on Enable Keyboard:
      Code:
      Private Sub chkEnableControls_AfterUpdate()
      Dim frm1 As Access.Form
      Dim frm2 As Access.Form
      
      Set frm1 = Forms!Form2
      Set frm2 = Forms!Form3
      
      With frm1
        'Must first shift Focus to another Field on the Form, since
        'you cannot disable a Control should it have the Focus
        ![Text1].SetFocus
          ![Sign In].Enabled = Me![chkEnableControls]
          ![Search].Enabled = Me![chkEnableControls]
      End With
      
      With frm2
        'Must first shift Focus to another Field on the Form, since
        'you cannot disable a Control should it have the Focus
        ![Text1].SetFocus
          ![Sign In].Enabled = Me![chkEnableControls]
          ![Search].Enabled = Me![chkEnableControls]
      End With
      End Sub

    Comment

    • Will James
      New Member
      • Dec 2011
      • 11

      #3
      Thanks for your reply,

      I didn't make it clear on my question!

      the 'Search' and 'Sign In' are the name of the forms not buttons.

      the buttons that are on the form are a on screen keyboard. I am trying to think of a way of explaining it easier that I did above but not having much luck!

      Comment

      Working...