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

CHANGING PROPERTY OF FORM FROM CODE

Status
Not open for further replies.

fsweb2002

Programmer
Apr 11, 2002
94
TR
Hi,

I have the following code running on ONLOAD for a form.

Form_Buying_Rates_Global_Change.AllowAdditions = True

However, it gives me an error (error 424, requires an object)

Any ideas what I have done wrong?

Note that the actual code is on a global module, which is called everytime after "login in" and selecting a form (menu)

Depending on the user login in and the form being opened, it charges the parameters of each form depending who the user is.

Therefore I cannot change the property of the form to YES or NO directly on the property window of the form...
 
HI

Im guessing its because it has no valid object to work with. Have you declared "Form_Buying_Rates_Global_Change" as a form object ?

Here is a simpler way to achive same effect :

Me.AllowAdditions = True

Access see's "Me" as the current form Object. Hope this helps..

Opp.
 
Yes, I did try me.allowedits=true but it gave me an error too.

I´ll try declaring it, see if it works.

Thanks for your help
 
Hmm...It may be becasue you are trying to set this property from an external (to the form) function. I only say this because I tried the code above (using the me clause) and it worked without error messages.

May I suggest that you try the folowing :

1. Create a global function to determine user privalages (something perhaps called canChange which returns true or false)

2. Call this function on the "onOpen" event on the form. And based on the result then use the "Me.AllowAdditions" syntax in the onOpen code to determine if they can make changes.

I cant see why the above would fail. Anyway, hope that helps

Opp.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top