Results 1 to 9 of 9
  1. #1
    Ctrl-v is offline Novice
    Windows 10 Access 2016
    Join Date
    May 2018
    Posts
    17

    Disable a frame with 2 or 3 option button inside depending on another filed in the same form

    Hi,



    I am new to Access. Very new. I have had a lot of experience with certain aspect of Excel, but not with VBA.

    I am making a form for work. The form is meant to be a sort of checklist for people to use. Some things on the checklist are not needed and should not be completed depending on the answer to one of the other fields on the same form. The other filed is a combo box. If a specific 2 choices of the combo box is selected I want to disable a frame with 2 to 3 option buttons in it. How do I do this. I am extremely new to VBA, so I would gratefully appreciate if you can be quite specific with me.

    All help is greatly appreciated!!!

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    something similar to:

    Code:
    sub cboBox_afterupdate()
    
    option1.enabled = true
    option2.enabled = true
    
    select case cbobox
       case "Male"
           option1.enabled = false
       case "Female"
           option2.enabled = false
    end select
    end sub

  3. #3
    Ctrl-v is offline Novice
    Windows 10 Access 2016
    Join Date
    May 2018
    Posts
    17
    Hmm...

    I'm running into problems. Can you explain to me which pieces of the string I should replace to match what I am working with?

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Substitute cboBox, option1, option2 with your control names.

    Replace Male and Female with your values.

    Exactly what 'problems' - error message, wrong results, nothing happens?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    Ctrl-v is offline Novice
    Windows 10 Access 2016
    Join Date
    May 2018
    Posts
    17
    Quote Originally Posted by June7 View Post
    Substitute cboBox, option1, option2 with your control names.

    Replace Male and Female with your values.

    Exactly what 'problems' - error message, wrong results, nothing happens?

    I don't remember because I tried making several edits since it not working the first time.

    I attached it.

    I am trying to have the "Harp status" frame to be disabled the the "harp status" combo box is selected as blank or "None"

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Attached what and where?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    Ctrl-v is offline Novice
    Windows 10 Access 2016
    Join Date
    May 2018
    Posts
    17
    Guess something went wrong the first time. It should be attached now.
    Attached Files Attached Files

  8. #8
    davegri's Avatar
    davegri is offline Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,413
    Add this VBA code behind the form
    Code:
    Option Compare Database
    Option Explicit
    
    Private Sub ComboHarpStatus_AfterUpdate()
        Call ControlFrame
    End Sub
    
    Private Sub Form_Current()
        Call ControlFrame
    End Sub
    
    Private Sub ControlFrame()
        If ComboHarpStatus = "NONE" Or IsNull(ComboHarpStatus) Then
            Frame125.Visible = False
        Else
            Frame125.Visible = True
        End If
    End Sub

  9. #9
    Ctrl-v is offline Novice
    Windows 10 Access 2016
    Join Date
    May 2018
    Posts
    17
    Thank you very much! It worked!

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 01-26-2018, 03:25 AM
  2. Replies: 3
    Last Post: 12-02-2012, 09:38 AM
  3. Replies: 2
    Last Post: 11-30-2012, 08:03 PM
  4. Adding option within a frame
    By crowegreg in forum Forms
    Replies: 1
    Last Post: 09-11-2012, 01:51 PM
  5. Replies: 0
    Last Post: 03-16-2006, 04:59 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums