Hiding a cmd button

D

Diogo

Hi,
Need some help.
How do I Hide a command button on form 2, based on a value enterd on form 1?
Form 1 runs hiden on the background.
I want a command button to be visible only to some users.
Thanks
 
J

J. Goddard

Hi -

While in form2:

if forms![form1]![controlname] = testvalue then
me![commandbutton].visible = false
else
me![commandbutton].visible = true
endif

John
 
T

tina

or, if you prefer, the shorter "toggle" code for John's solution, as

Me!CommandButtonName.Visible = Not (Forms!Form1!ControlName = testvalue)

the above goes all on one line in the VBA procedure.

hth


J. Goddard said:
Hi -

While in form2:

if forms![form1]![controlname] = testvalue then
me![commandbutton].visible = false
else
me![commandbutton].visible = true
endif

John

Hi,
Need some help.
How do I Hide a command button on form 2, based on a value enterd on form 1?
Form 1 runs hiden on the background.
I want a command button to be visible only to some users.
Thanks
 
Top