Hiding a cmd button

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
Hi -

While in form2:

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

John
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top