Results 1 to 4 of 4
  1. #1
    RunTime91 is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Dec 2014
    Posts
    284

    Help With Grouped Option Button Code

    Hello Hello



    Not sure how to title my thread other than like that...

    Setup:

    I have a grouped frame with 4 Option Buttons (#'s 1, 2, 3 & 4)

    What I am trying to accomplish is simply when a user selects one of the four buttons a certain collection of controls associated with that Button will appear on the UI and the other three buttons become hidden by setting their .Visible property to False. This code is written in the GotFocus Eventfor each button.

    I also have a Reset button which resets the form and also resets the .Visible property of the other three buttons back to True and in addition I am also setting the Frame = False. I'm doing this in an attempt to clear the value of the frame which I know inherits the value of whatever button the user clicks.

    Unfortunately, and as I am sure many of you reading this already know, that does not reset the frame value and if the user clicks another button the code for the prior button will run - very frustrating.

    So I guess my question is, is there a way to clear the inherited value of the frame so users can select a button, reset the UI and select another button and have it trigger the correct event?

    The code below is from the Reset button
    Code:
    With Me
      .OptNwHire.Visible = True
        .OptNAC.Visible = True
          .OptExtAcces.Visible = True
        .OptTermTrans.Visible = True
      .FrameTktType = ""
    End With
    As always - Thank you!

  2. #2
    isladogs's Avatar
    isladogs is offline Access MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    6,204
    I didn't completely understand the Reset part of your post.
    The visible state of each control can easily be managed using the controls' tag property.
    For an example, see http://www.mendipdatasystems.co.uk/s...ols/4594398114
    Colin Riddington, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I know I don't know, I keep quiet!

  3. #3
    RunTime91 is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Dec 2014
    Posts
    284
    Hey Ridders...

    The Reset CmdButton works the same was as the Enable/Show/Unlock All button on the example you provided. It just resets the UI (remember, each button displays a specific set of form controls) and in resetting the UI it also resets the .visible property of the three option buttons which were set to .visible = False...back to .visible = True

    As an Update:

    I was experimenting with the Frame Click Event and using Case Statements for the different buttons - I'm still using the same reset code as above and it seems to work; however it feels a little slow and somewhat clunky

    I'm not familiar with using control tags - I'll have to read up on that.

    I would like to not have to use ifs or case statements and just code directly to each button, but that would require somehow resetting the frame value.

    All idea's are welcome

    Thanks Ridders

  4. #4
    Minty is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,157
    Based on what you are trying to achieve, I'm not sure i would use an option group for this.
    Option groups aren't really designed to be switched on and off like this, they are exactly what they say a option selection.

    Either try opening the form with four small command buttons and simply enable/disable them based on whichever one is pressed?
    Or simply disable the option group after the option is selected?

    Me.YourOptionGrp.Enabled = False
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

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

Similar Threads

  1. Replies: 3
    Last Post: 10-20-2014, 03:25 PM
  2. sort option button
    By turk in forum Access
    Replies: 9
    Last Post: 03-08-2012, 03:16 PM
  3. Replies: 5
    Last Post: 08-22-2011, 11:24 AM
  4. Option Button with Negated Value
    By rohnds in forum Forms
    Replies: 3
    Last Post: 08-09-2010, 07:07 AM
  5. Problem on Option Button
    By cwwaicw311 in forum Forms
    Replies: 2
    Last Post: 02-10-2010, 10:44 AM

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