Results 1 to 4 of 4
  1. #1
    Lupson2011 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Aug 2011
    Posts
    68

    Making a Command Buttong Visible/Invisible

    Hi



    I am working on a database in which I am trying to write some code which displays a command button dependant on another action.

    In my example, I have two check boxes which I have set up to allow only one choice. So when you check one, the other becomes unchecked!

    Behind both these check boxes I have managed to write the code which does make the command button visible/invisible depending on which check box is checked. See bellow

    Private Sub ChangeOnly_Click()
    Me.ChangeAndImpact = Disable
    If Me.ChangeAndImpact = "0" Then Forms!SChangeContactDetails!SChangeRecommendations !Button.Visible = True

    End Sub


    Private Sub ChangeAndImpact_Click()
    Me.ChangeOnly = Disable
    If Me.ChangeAndImpact = "-1" Then Forms!SChangeContactDetails!SChangeRecommendations !Button.Visible = False

    End Sub


    However, the crucial bit I am missing is that it does the same response for ever record. So if I want it invisible in one record thats fine,but then if you go to the next record where you want it to be visible, and have checked the correct box for this to happen, it is still invisible.

    What I need is some additional coding which ties it to the current record?

    Advice, as always, gratefully received!

    bagpuss

  2. #2
    Robeen is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Mar 2011
    Location
    Tulsa, Oklahoma.
    Posts
    1,596
    You could explore the 'On Current' Event of your Form and put your code in there to check the field on which you are basing the visibility of the Button.

    Hope this helps!

  3. #3
    Lupson2011 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Aug 2011
    Posts
    68
    Thanks, worked it out

    bagpuss

  4. #4
    Robeen is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Mar 2011
    Location
    Tulsa, Oklahoma.
    Posts
    1,596
    Did you use the On Current event?

    It might help someone one day if you post your solution here.

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

Similar Threads

  1. Replies: 11
    Last Post: 06-30-2011, 11:12 PM
  2. Making subform field visible/invisible
    By Snufflz in forum Forms
    Replies: 3
    Last Post: 01-17-2011, 05:30 AM
  3. Invisible/visible box
    By teirrah1995 in forum Forms
    Replies: 4
    Last Post: 10-03-2010, 02:45 AM
  4. Setting fields visible/invisible
    By col5473 in forum Forms
    Replies: 1
    Last Post: 09-17-2010, 09:14 AM
  5. Combo Boxes Visible/Invisible
    By Rick West in forum Forms
    Replies: 2
    Last Post: 07-06-2010, 09:41 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