ENVIRON no longer working

T

timmer

I created a report to put the user's logon name in a text
box on the page footer and set the source to ENVIRON
("USERNAME"). This report was created in XP developer &
installed on client PC with runtime. WORKED JUST FINE!

Just got a new batch of computers from Dell, preloaded
with W2KPRO & OfficeXPsmallbusiness.

When users open the reports on these new machines, the get
a parameter box asking for ENVIRON.

I ran an immediate window and was able to Debug.Print
Environ("USERNAME").

Any suggestions as to where I should look to resolve this
parameter prompt?

Thanks.
 
W

Wayne Morgan

I'm not familiar with using the Runtime version, so I'm just guessing.

Right off hand, it sounds like a bad reference. In the non-runtime you would go to a code
window then Tools|References to check.

Have you gone to a Dos prompt and typed the Set command to see if the environment variable
actually exists as it should?

You may find using the Windows API to get the current user login more reliable. This will
only work on NT computers (i.e.. NT4, Win2k, WinXP).

http://www.mvps.org/access/api/api0008.htm
 
T

timmer

Thanks for the reply Mr. Morgan.

I agree about the reference but don't know how to resolve
or what else I need to check.

I verified that the new Dell machines and the older PC are
both using the same date/version reference for "Visual
Basic for Applications" - VBE6.DLL

My applications are also having problems with another VB
function, FORMAT. ENVIRON and FORMAT are problems in both
runtime and developer on these new Dell machines but work
just fine on older machines.

While I appreciate the reference to the Windows API code
you provided, this doesn't solve my problem because I
would also have to come up with an API code change for
FORMAT.

I did check the DOS/WINDOWS environment via SET and
USERNAME is showing correctly.

In an Access VBA debug immediate window, I can type "PRINT
ENVIRON("USERNAME")" and get the correct user name - it
just doesn't work within a form or report?

The only other thing I can think of is the number
of "Visual Basic for Applications" references that are in
Access. In addition to the one mentioned at the top of
this reply, the new Dell machines have 5 other references,
the older machines only have 4. Access will not allow me
to select any of the other VBA references, on either the
new or older PC. But these other references aren't
checked either - they just show up on the available
reference listing.

Again, thanks for your reply,

timmer
-----Original Message-----
I'm not familiar with using the Runtime version, so I'm just guessing.

Right off hand, it sounds like a bad reference. In the
non-runtime you would go to a code
window then Tools|References to check.

Have you gone to a Dos prompt and typed the Set command
to see if the environment variable
actually exists as it should?

You may find using the Windows API to get the current
user login more reliable. This will
 
W

Wayne Morgan

I don't know which permission it would be, but if you log onto the computer with
Administrative permissions does it work? This shouldn't help the Format problem though. It
still sounds like a reference in the Access Runtime, but I don't know how to set them in
the runtime. In the regular version you would open a code window and go to
Tools|References.

I have 5 others as well, I'm running Office 2002 Pro. The one that is selected is located
at
C:\Program Files\Common Files\Microsoft Shared\VBA\VBA6\VBE6.DLL. If you look at the
paths, you will see that the others point to different files. I don't know what each of
them is, but Access will only let you select one of each name, so you would have to
uncheck the current one to change to a different one.
 

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