Disabling command buttons on a form before opening it - can it be done?

04-14-2004, 09:30 PM
I am wanting to use my system with 2 sets of users...

When the form has been opened...
User 1, I want to allow the editing the records by using command buttons

User 2, I would like the user to be able to browse back and forwards, but NOT be able to Add/Amend/Delete records.

I already have the form setup with the controls described for User 1.

What I am wondering is, is it possible, using exactly the same form, I could open it for use with some of the buttons disabled?

eg. for User 2


frmNewForm.cmdAdd.Enabled = False
frmNewForm.cmdUpdate.Enabled = False
frmNewForm.cmdEdit.Enabled = False


Would this work?

Or is there some other way I must go about it?

04-14-2004, 11:13 PM
Yes, you can do that - if frmNewForm is not loaded it will load when you access the first control (cmdAdd) - and the FormLoad procedure will execute (I believe - I'd have to verify that the sequence of these events would occur in exactly that manner).

Another way to achieve this result would be to have a global variable to use for flags which you test on FormLoad and condition your controls accordingly.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum