PDA

View Full Version : enable command button based on field value



saro
02-27-2011, 11:06 PM
Dear All,
I have a query result viewed in a single form which have some command buttons that will open external files. Is there a way to disble or enable the command buttons if one field contains a specfic text string.( field values will be "Control Valve", "Transmitter", etc. If the field has the value "Valve". Command button 1 should be enabled.).
My Code looks like this.
If Me.Type.Text = *&Valve&*
Me.Commandbutton1.enable = True
Else
Me.Commandbutton1.enable = False

which gives an error.
But if it is
If Me.Type.Text = "Valve"

It works. But I want it to work if part of the field contains "Valve".
any suggestions? thanks

saro

saro
02-27-2011, 11:20 PM
Hi
I found the answer,
It should be
If Me.Type.Text Like "*Valve*" then
Thanks any how