Results 1 to 5 of 5
  1. #1
    chef6886 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jan 2013
    Posts
    3

    Option Group Question

    I have a fairly advanced procedure that I'm trying to do to help cut down on code from multiple calls. Running into a few problems, so if anyone has any suggestions I would appreciate it in advance. FYI, I am really well-versed in VBA programming...a bit rusty as I've been out of it, but you aren't going to panic me if you answer with some complex code behind it...many thanks in advance...

    Scenario: Trying to develop a form that pulls from a fairly sizable table. I have toggle buttons in an option group to filter...13 to be exact with each one filtering two letters of the alphabet...e.g. A-B, C-D, etc. The option group is named optFilters, and each toggle button is named according to the filter it does...e.g. tglAB, tglCD, etc.



    Program Function: I can get the filter to work just fine and reset to the itemvalue of 0 when I use a reset command button. Because windows default color toggle buttons are not always easy to spot, I want to change the foreground color of the active toggle button based on its "true" state, for lack of better terms. I want it to change to light red, which I am able to do with the QBColor(value) command just fine.

    Problem: What I'm running into a stone wall on is I want the program to cycle through all of the command buttons and find the ones that are not active (state = False...again for lack of better words) and change the forecolor back to black if it is not the active one. Basically, as the user is pressing the toggle buttons, the last one pushed would change its forecolor to red and the others will be black...since I want to limit the coding rather than gorilla-coding this with bloat-ware, that's where my problems lie.

    I could use some suggestions if you have any. I've been hammering at this one problem for 2 days, and all of the "help" I've found on the web hits around the problem but never directly at this one. It may be that I'm just tired and overlooking something insanely simple (bangs head on desk...doh)...but any help would be appreciated.

    Thanks again in advance.

    E

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,742

  3. #3
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,962
    Why not radio buttons instead? The active button is easily identified. I know, can't resize the buttons, darn it!

    Try something like:

    Sub Frame1_AfterUpdate()
    Me.tglAB.ForeColor = IIf(Me.tglAB.OptionValue = Me.Frame1, vbRed, vbGreen)
    Me.tglCD.ForeColor = IIf(Me.tglCD.OptionValue = Me.Frame1, vbRed, vbGreen)
    ...
    End Sub

    If you named the toggles like tgl1, tgl2, etc.
    For i = 1 to 13
    Me.Controls("tgl" & i).ForeColor = IIf(Me.Controls("tgl" & i).OptionValue = Me.Frame1, vbRed, vbGreen)
    Next
    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.

  4. #4
    chef6886 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jan 2013
    Posts
    3
    Thanks, Orange...but that really didn't help me much...I already know the controls on the form...just having issues with changing properties on the option group...plus, unless I'm mistaken, this was for 2010...I wish MS had thought to give the back color feature on toggles and command buttons before the 2010 release...

    Any other thoughts?

  5. #5
    chef6886 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jan 2013
    Posts
    3
    Thanks, June...I'll try it out in a bit...

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

Similar Threads

  1. Option Group Query
    By SeaTigr in forum Queries
    Replies: 13
    Last Post: 04-23-2012, 12:49 PM
  2. Option Group
    By x__hoE__x in forum Access
    Replies: 2
    Last Post: 12-10-2011, 09:39 AM
  3. Option Group - Borders are gone
    By cevatyildiz in forum Forms
    Replies: 0
    Last Post: 04-30-2010, 06:08 AM
  4. Option Group
    By huskies in forum Forms
    Replies: 9
    Last Post: 12-02-2009, 12:06 PM
  5. Option Group broken out
    By dcecil in forum Reports
    Replies: 3
    Last Post: 04-21-2009, 10:30 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