Heenan, Lambert
Lambert.Heenan at AIG.com
Tue Nov 20 12:29:46 CST 2007
Is there a workaround? No. You have to use an API call to get the user ID. So quit defaulting these fields in your tables and add a tiny bit of code to the BeforeInsert (for new records) and BeforeUpdate (for edits) events on your forms. There's only a very limited list of functions you can use in the default value property of field in table design view. It was even documented once, but I'm damned if I can locate it in the Access XP help file. Oh well. BTW it also makes sense to not allow Environ(). Environ is a risky proposition because it is quite easy for a user to change an environment variable, (like "USERNAME") and so potentially bypass 'security'. Lambert -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of O'Connor, Patricia (OTDA) Sent: Tuesday, November 20, 2007 12:34 PM To: Access Developers discussion and problem solving Subject: [AccessD] Populate field with userid Environ A97 vs A2k+ I am upgrading an Access97 to Access2k to Access2k3. I know about having to create a function to use it in A2k and A2k3 (GRRR) I have been using =Environ("UserName") to populate a field (LastUpdtBy) in a new record in my A97-tables for years. I created the function that was recommended and it works in my vb/vba code portions. It is not working in the table field default. Gives me the runtime error # 3388 "unknown function 'Environ'. Is there a workaround? If there is one in the archives, please send a complete link. I have tried finding something suggested in mails but can't find them easily. I still think this ban was ridiculous or at least they should have created a valid totally useable workaround Thanks - Have a wonderful Thanksgiving ALL Patti ************************************************** * Patricia O'Connor * Associate Computer Programmer Analyst * OTDA - BDMA * (W) mailto:Patricia.O'Connor at otda.state.ny.us * (w) mailto:aa1160 at nysemail.state.ny.us ************************************************** -------------------------------------------------------- This e-mail, including any attachments, may be confidential, privileged or otherwise legally protected. It is intended only for the addressee. If you received this e-mail in error or from someone who was not authorized to send it to you, do not disseminate, copy or otherwise use this e-mail or its attachments. Please notify the sender immediately by reply e-mail and delete the e-mail from your system. -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com