Results 1 to 9 of 9
  1. #1
    Join Date
    Apr 2004
    Posts
    62

    Unanswered: command button being visible depending on control criteria

    Hi
    I would like to make a command button appear on a form only when certain criteria is put in a control on the form.

    For example, one of the controls has a drop down menu. When the user picks "Washed" from this menu I would like a comman button to appear.

    The control is called status and the command button is called searchali.

    so far I have tried this:in the after update of the control.

    If([status] = "Washed", [searchali].visible = True, [searchali].visible = False)

    or
    If([status] = "Washed" then me.[searchali].visible = true else me.[searchali].visible = false)

    an other variations of this and I can't get it to work. I've set the command button to visible = no to start with and the bound column of my control to 0 since I want the first column criteria.

    If anyone can see where I might be going wrong, or if there is another way of doing this I would be sooooo grateful!
    thanks,
    Sue

  2. #2
    Join Date
    Oct 2004
    Location
    Oxfordshire, UK
    Posts
    89
    Try:
    [searchali].Visible=([Status]='Washed')
    Note single quotation marks.

    And make sure the value of [Status] is actually that column. If you have more than one column and the text value isn't the BoundColumn then you'll have to refer to that column explicitly.

  3. #3
    Join Date
    Feb 2004
    Posts
    90
    You'll need to put the code in the afterupdate property of the combo box and the onCurrent event of the form.

  4. #4
    Join Date
    Oct 2004
    Location
    Oxfordshire, UK
    Posts
    89
    Good point Goldy :-)

  5. #5
    Join Date
    Apr 2004
    Posts
    62

    continuous

    Hi,
    I think I've nearly got it working, but I'm using a continous form, so the buttons appear on all the controls, is this going to cause issues?

    If so I've seen that I can change the format of the button, conditional formatting but if I go into design view of the button then up to conditional formatting it is not highlights so I cannot pick it as an option!!

    ???
    any ideas?
    Sue

  6. #6
    Join Date
    Oct 2004
    Location
    Oxfordshire, UK
    Posts
    89
    Dodge the issue by putting controls like this on the form footer! The same principle is used when enabling/disabling and revealing/hiding buttons on a toolbar...

  7. #7
    Join Date
    Apr 2004
    Posts
    62
    If I put the button in the form footer I'm not sure it'll give me what I want. I like the idea though and am going to give it a go..but ideally I want this:

    Form
    Record button
    Record button
    Record
    Record button.

    If the button is in the footer I won't be able to link it to many records on one form will I?
    Sorry if I'm being a pain!!
    It's just bugging me now"
    thanks
    Sue

  8. #8
    Join Date
    Oct 2004
    Location
    Oxfordshire, UK
    Posts
    89
    If you place the code snippit in the Form_Current event procedure (as well as the drop down menu AfterUpdate event as suggested by Goldy) the button.visible property will change as you navigate records.

    You can reduce screen flicker by modifying the code like this:

    If Not [searchali].Visible=([Status]='Washed') Then
    [searchali].Visible=([Status]='Washed')
    End If

    OK you'll not get the visual feeback that you'd have if the repeated CommandButton could have criteria formatting but I don't believe it's possible with anything except TextBox controls. This is an acceptable compromise that, as I've said, is used in setting properties of CommandBar (ToolBars, MenuBars, SubMenus) controls so your users should be familiar with this idea.

  9. #9
    Join Date
    Apr 2004
    Posts
    62
    ok thanks I'll give it a go!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •