Autofill detail with users name?

FlyingMonkey

New member
Local time
Today, 04:59
Joined
May 1, 2014
Messages
8
I have set up a split database and it seems to work perfectly. I have created a report on each users FE and this works fine. It inputs their own contact details on the report. This was done manually before sending the FE to the user just using ="text here" in the design of the form.

What I want to do is add an extra field to the table (and link to this via the form each user has) and have this populated automatically with the users name.

This is so we can see at a glance which user added which record.

Is there a way to have this happen or would it be a case of having to pick your own username from a combo box?

Can I do something with each users FE form which will add their name when they add a record?
 
Last edited:
The Windows username can be returned with:

Code:
CreateObject("wscript.network").UserName

Put this in a user defined function and use it as the default for the textbox.
 
For many, many years to achieve this I've always used declares and I'm fearing in the not too distant future I'll come a cropper with the 32 / 64 bit issues. At present our organisation is upgrading to 32 bit versions of Office 2010 on 64 bit Windows 7 desktops.

I'm sure when I first adopted this process using declares was the only option available (Access 95). Appears things have changed and now a simple one-liner. Anyway, did a a little Google search on this and came across another one-liner approach. The following is from my immediate window:
Code:
 ? CreateObject("wscript.network").UserName
vp2404500
? Environ$("username")
vp2404500

? CreateObject("wscript.network").ComputerName
WP01576092
? Environ$("computername")
WP01576092

Is there a preferred approach or is it just a matter of personal preference?

Always learning.
 
Is there a preferred approach or is it just a matter of personal preference?

The environment variable defaults to the username but can easily be changed so it isn't ideal.

Type the following in a cmd window and hit return. Then see what Environ("username") returns.
Code:
Set username=whatever

Better to return the actual username.
 
The environment variable defaults to the username but can easily be changed so it isn't ideal.

Type the following in a cmd window and hit return. Then see what Environ("username") returns.
Code:
Set username=whatever

Better to return the actual username.

Thanks. The actual username it is.

Note to self: Check other declares see if they can be replaced. I think the File Save/Open dialog box can - this maybe the subject of another thread.
 

Users who are viewing this thread

Back
Top Bottom