Default value in table field (username and computername)

M

mario

This used to work fine in Access 2003 to insert a default value in a field.
=Environ("USERNAME") & " on " & Environ("COMPUTERNAME")

Can you please let me know what is the equivalent in Access 2007
 
D

Douglas J. Steele

I believe it should work in Access 2007 as well, although I always cringe
when I see people use the Environ function to return the user ID given how
easy it is to change.
 
J

Jeff Boyce

I'm with Douglas on the vulnerability of this approach. Have you looked
into using a call to obtain the NT logon instead?

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
D

Duane Hookom

These won't work as field defaults in a table design but will work as
defaults for controls in forms. Users should only interact with forms so this
should work.
 
M

mario

"Thanks Duane. I would ideally do something like "=Environ("USERNAME") & "
on " & Environ("COMPUTERNAME")" in the default value of the field in table
design, without having to deal with form.

I agree, I am not a IT person. Why are people saying that "I always cringe
when I see people use the Environ function to return the user ID given how
easy it is to change".

If it was easy to accomplish in Access 2003 using "=Environ("USERNAME") & "
on " & Environ("COMPUTERNAME")", why was it taken off in Access 2007 without
an alternate way of doing it.

Thanks
Mario
 
D

Duane Hookom

I'm not sure why the functionality was removed. To be honest I was very
surprised to hear that it worked in earlier versions.

Many of us "mature" Access programmers don't believe in offering table
datasheet views to users. There is much greater control and functionality
with forms.
 
J

Jeff Boyce

Hey, Duane!

I heard a new (for me) definition of "expert" ... someone who's made more
mistakes than you ...

Sorta reminds me of my gramma's definition of "middle-aged" ... halfway
between my age and the age of the oldest person I know (she was 85 at the
time...)

Jeff B.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top