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

Environ

Status
Not open for further replies.

mpm32

Technical User
Feb 19, 2004
130
US
I am having the hardest time with what should be very simple. I created a new database, there is a table with a field called AddedbyUser. I want to populate the field from a form with the network ID. I have done this before on all of my other databases and it works fine.

On the BeforeUpdate I use,

Code:
Private Sub Form_BeforeUpdate(Cancel As Integer)

    Me!AddedbyUser = Environ("username")

End Sub

On this database I get the error;

The expression Before Update you entered as the event property setting produced the following error: Object or class does not support the set of events.

*The expression may not result in the name of a macro, the name of a user-defined function or [Event Procedure].
*There may have been an error evaluating the function, event or macro.

I have copied everything over from my previous working databases where this works.

I have even made sure that all the same references were checked.

I am baffled as to why this is not working now.

Can anyone help?
 
i learned that environ can be blocked from remou,

see: thread702-1446342

.....
I'd rather be surfing
 
Hmm thanks, it says 2003 and above. I'm using Access 2000. So it shouldn't be the cause of my error. Especially since I'm using the other databases where it works.
 
sorry, did not read close enough.

are any of the other environ variables available to you.

Can you call environ variables from the immediate window:
Code:
? environ("username")

.....
I'd rather be surfing
 
Yes I can. Environ does work from the immediate window.
 
then i think it might be a problem with the specified form event. Can you trigger your environ code from a different control on the form? I would also recheck all the properties of the AddedbyUser control, ie data format, control source etc.

.....
I'd rather be surfing
 
I'm not sure what happened but I just started over with a new form and it now works. Thanks for your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top