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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

command buttons (IF Statement)

Status
Not open for further replies.

Muzzy

Programmer
Dec 14, 2001
68
GB
I have a 4 command buttons on a form, cmd1, cmd2, cmd3, cmd4. they run in or of number {1,2,3,4) sometimes cmd2 is not enabled so I want to jump from cmd1 to cmd3
I need some way of saying if that is cmd 2 is not enabled then goto cmd3 and if cmd3 is not enabled then go to cmd4.
Please Help Me!
 
Hi

If a Command Button is not enabled, it will be skipped in the Tab Order. For example, if Cmd1 and Cmd3 were enabled and Cmd2 wasn't when you tab from Cmd1, the focus will move straight onto Cmd3. Is this what you mean?

Also if you want to set the Tab Order goto the code window then View->Tab Order.

NSS.
 
Unfortunately not, what happens is that on a main form I have sub forms that open, when data is added in the sub form I close it and disable the cmd button on the main form so no more data can be added to that particular subform. I have to shift the focus to the next button to be able to disable it.

if I try to shift it to cmd2 and this is already disabled then I get an error. I need to say something like:
if cmd2.enabled = false
then do.cmd.gotocontrol"[cmd3]"
else do.cmd.gotocontrol"[cmd2]"
If cmd3enabled =false
then do.cmd.gotocontrl"[cmd4]" and so on
But command buttons 2+ 3 might be disabled so I'll have to go to button 4.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top