Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Make Button visible 1

Status
Not open for further replies.

sham14

MIS
May 14, 2003
42
NL
I am opening a form and then want to make certain buttons visible and other buttons not visible.
I open the form and then run code to make these changes
This is example of some of the code:
Forms!myform.cmdprevious.Visible = Yes.
Forms!myform.cmdsave.Visible = No.

If i run the code above the cmdsave button will be made invisible but cmdprevious button will not be visible on the form.

Any idea?
Thanks in advance
 
Use TRUE or FALSE to set visible states or vbYes and vbNo
Yes and No mean absolutley diddly squat to VBA
The only reason that one of them "works" is that VBA is viewing it as an empty variable which is evaluating to 0 which is equivalent to FALSE
So, in essence, your code is setting them both to invisible

Rgds
Geoff
"Some cause happiness wherever they go; others whenever they go."
-Oscar Wilde
 
Based on what xlbo's just said I'd suggest also using Option Explicit to enforce variable declaration as I couldn't recreate the problem without removing it.

In the VBE go TOOLS>OPTIONS Editor tab and tick 'Require Variable Declaration'
;-)

If a man says something and there are no women there to hear him, is he still wrong? [ponder]
 
Thanks a lot - Fixed my problem - as you may have guessed i am quite new to this :).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top