Results 1 to 5 of 5
  1. #1
    Stephenson is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Sep 2015
    Location
    North West
    Posts
    110

    Use option button to make textbox not visible


    Hello all,

    I have two option buttons, opHourly and opDaily. They're in option group frmRate. I would like them to make two textboxes, tboHourly and tboDaily visible and not visible. I've searched for answers that should work for me, but nothing is doing the trick. Currently I'm playing around with the following code.

    Code:
    Private Sub Form_AfterUpdate()    
        Me.tboDaily.Visible = Me.frmRate = Me.tboDaily
        Me.tboHourly.Visible = Me.frmRate = Me.tboHourly
    End Sub
    I would like to open the form with them both not visible then have the user click one of these boxes to make them visible. Making them not visible I can do, the other part I can't

    Please let me know if you have any good ideas.

    Thank you for looking.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    Put code in frmRate AfterUpdate. Refer to the option buttons

    Private Sub frmRate_AfterUpdate()
    Me.tboDaily.Visible = Me.frmRate = opDaily.OptionValue
    Me.tboHourly.Visible = Me.frmRate = opHourly.OptionValue
    End Sub

    Is this form in Single view?
    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.

  3. #3
    Stephenson is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Sep 2015
    Location
    North West
    Posts
    110
    Thank you for the speedy reply June7.

    This form is in single view. I've replaced my line of code with yours and still nothing. It acts as though I don't have any code there. I have to be doing something simple wrong some place.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    In the frmRate AfterUpdate event property on the Property Sheet, select [Event Procedure]. Click the ellipsis (...) to open VBA editor at the procedure. Type code.

    Just did some testing. Referencing the option buttons doesn't work.

    Me.tboDaily.Visible = Me.frmRate = 1
    Me.tboHourly.Visible = Me.frmRate = 2
    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
    Stephenson is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Sep 2015
    Location
    North West
    Posts
    110
    Oh my goodness. I knew I was doing something wrong that should have been obvious.

    This works awesome. Thank you for the help.

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

Similar Threads

  1. Replies: 1
    Last Post: 02-27-2015, 10:01 AM
  2. Replies: 1
    Last Post: 12-19-2012, 08:09 PM
  3. Replies: 5
    Last Post: 08-13-2012, 06:57 AM
  4. make fields visible onclick() button
    By rivereridanus in forum Programming
    Replies: 4
    Last Post: 06-25-2012, 11:08 PM
  5. Replies: 10
    Last Post: 12-31-2010, 12:35 PM

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