making the command button visible sometimes

SusanC

Registered User.
Local time
Today, 10:37
Joined
Feb 18, 2004
Messages
66
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,
Sie
 
Sie

Try doing this with a macro. Even though I'm a newb I did something like this a while back.

Create a new macro ie. Washed_macro:

Condition: [status]="Washed"
Action: SetValue
SetValue = [searchali].[Visible]
Expression = Yes

Before this set the control "searchali" visibility to No.

Now all you have to do is to set after update of the "searchali" button to the macro you just created.
 
Try:

Code:
If Me.status.Column(0) = "Washed" Then
    Me.searchali.Visible = True
Else
    Me.Searchali.Visible = False
End If

Hope this helps?
 
Last edited:
Hi,
this looks interesting. I can see where to put everything except the condition part. Where does that go?
thank you for your help,
Sue
 
Hi,
i've found the condition part and it's almost working.

However, the button only appears if I click on the 'Washed' when the form opens. I would like the button to appear on entry, since this is not a data entry form.

Also, it is a continuous form and so I have several buttons, but they all appear if the first one is set to 'Washed'. How can they be specific for each control on each field?
does that make sense?
thanks for the help so far, I'm getting there slowly but surely!
Sue
 
Put the code on the AfterUpdate event of your combo box. You will probably also find you need the exact code on the "On Current" event of the form. Else once visible it may stay visible.
 
thanks for the help. I still couldn't get it to work for some reason but I managed to make some unbound controls instead and with conditional formatting I have made them work like a button.
cheers,

Sue
 

Users who are viewing this thread

Back
Top Bottom