UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> How To Disable A Forms Vba?, Office 2010    
 
   
icemonster
post May 5 2012, 10:24 PM
Post #1

UtterAccess Veteran
Posts: 324



is there a way to disable a forms vba? or what is the command use to disable a forms vba? thanks.
Go to the top of the page
 
+
theDBguy
post May 5 2012, 10:44 PM
Post #2

Access Wiki and Forums Moderator
Posts: 48,021
From: SoCal, USA



Hi,

A form's VBA only executes when tied together with an event. So, to disable it, just disconnect it from its event.

Just my 2 cents... (IMG:style_emoticons/default/2cents.gif)
Go to the top of the page
 
+
icemonster
post May 5 2012, 11:59 PM
Post #3

UtterAccess Veteran
Posts: 324



hm. no command to stop it? oh well, cause i'm making a user level access on some buttons and since i have them disabled depending on certain changes on the form the disabling them according to user level won't do well as planned.
Go to the top of the page
 
+
theDBguy
post May 6 2012, 12:04 AM
Post #4

Access Wiki and Forums Moderator
Posts: 48,021
From: SoCal, USA



Hi,

I'm not sure I understand your concern. If the buttons are disabled, then the VBA shouldn't execute. Isn't that what you want?

Just my 2 cents... (IMG:style_emoticons/default/2cents.gif)
Go to the top of the page
 
+
fkegley
post May 7 2012, 09:54 AM
Post #5

UtterAccess VIP
Posts: 23,583
From: Mississippi



Yes, you can do that. You'll need some way to tell whether or not the user has "rights" to functions on the form. Then you can place code in the Form's On Load event, possibly other events as well, to examine the user rights value, probably passed in by OpenArgs, other ways are possible, too and disable whichever buttons you don't want that user to use.

If OpenArgs = "End User" Then
Me.NameOfCommandButton.Enabled = False
etc.
Else
Me.NameOfCommandButton.Enabled = True
etc.
EndIf

I have only showed the code for two levels of user, but you can certainly add in more if you wish.
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 23rd May 2013 - 04:45 AM