Results 1 to 6 of 6
  1. #1
    Pittsy is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2016
    Posts
    3

    Are option buttons an option?

    I have a pair of option buttons in a form "repaired" and "Scrapped", I would like the focus to switch to a different control depending on which is chosen. as there is no OnClick to put an event into, how do I do this?

    Advice will be much appreciated
    Pittsy

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    its not onClick, you want AFTERUPDATE .
    add a FRAME, put the options in it. the FRAME gets the value and the events.
    event of the FRAME afterupdate , when the user picks it , turn on or off other items.

    Code:
    sub frame_afterupdate()
      select case frame.value
          case 0
             txtBox = "Repaired"
          case 1
              txtBox = "scrapped"
    end select

  3. #3
    Pittsy is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2016
    Posts
    3
    Great but how do I tell it where to go (so to speak)? If they select repaired I want to go to Repairs done control, If they choose scrapped I want to go to Date Scrapped. Sorry if this is making me look a bit foolish..

  4. #4
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Using the example form Ranman256, the code might look like:

    (Option value for "Repaired" = 1, Option value for "scrapped" = 2)
    Code:
    sub frame1_afterupdate()
      SELECT Case frame1.value
          Case 1
            'If the control name is "Repairs_done"
            Me.Repairs_done.SetFocus
          Case 2
            'If the control name is "Date_Scrapped"
            Me.Date_Scrapped.SetFocus
    End Select
    Note that I replaced the space with underscores in the control names.....

    Replace "Frame1" with the name of your frame control and the "Repaired" & "Scrapped" controls with your names.

  5. #5
    Pittsy is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2016
    Posts
    3
    Brilliant guys,

    Works a dream.

    Thanks for your input.

    Pittsy

  6. #6
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    It sounds like your problem is solved. I will mark this "Solved" for you.

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

Similar Threads

  1. Option Buttons
    By Cyber27uk in forum Access
    Replies: 1
    Last Post: 01-10-2013, 03:45 PM
  2. Option buttons
    By Ecal in forum Programming
    Replies: 2
    Last Post: 11-11-2012, 09:04 AM
  3. Use of option group buttons
    By sireesha in forum Forms
    Replies: 1
    Last Post: 10-25-2012, 01:20 PM
  4. Option buttons
    By chazcoral2 in forum Forms
    Replies: 11
    Last Post: 09-13-2010, 07:53 AM
  5. option group radio buttons
    By ManC in forum Forms
    Replies: 9
    Last Post: 03-08-2010, 03:46 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