Solved Display name of person logged into DB not computer (1 Viewer)

Mick3911

Registered User.
Local time
Today, 15:10
Joined
Jul 31, 2018
Messages
40
I have a DB where various users create records.

Before they can do that they need to log into the DB.

What I would like to happen is that the person’s name who is actually logged onto the DB to be displayed on a form in a field named ‘SubmittedBy’.

I have seen how to display a user who is logged on a computer but I don’t want this option.

The reason behind this is that 3 people (who work 3 different shifts) use the same log in details for the computer.

How do I go about doing this?
 

isladogs

MVP / VIP
Local time
Today, 15:10
Joined
Jan 14, 2017
Messages
18,211
Save the logged in user name as a public variable stUserName so it can be called at any time

Ina standard module, add
Code:
Public strUserName As String

On the login form
Code:
strUserName=Me.txUserName

On your form
Code:
Me.SubmittedBy= strUserName
 
Last edited:

Mick3911

Registered User.
Local time
Today, 15:10
Joined
Jul 31, 2018
Messages
40
Hi isladogs,

Thanks for your reply.

Is the code to be entered in the 'On load' for both forms?
 

isladogs

MVP / VIP
Local time
Today, 15:10
Joined
Jan 14, 2017
Messages
18,211
I assume users enter their info on the login form.
If so, you need to put that line in the txtusername after update event or on the click event for the login button.

If they don't login you can just use their network username.
See http://www.mendipdatasystems.co.uk/get-user-name/4594424315

Yes to the form load event for the other form
 

theDBguy

I’m here to help
Staff member
Local time
Today, 07:10
Joined
Oct 29, 2018
Messages
21,467
Hello. I am just posting this info to let everyone else know there are other options available. See TempVars.
 

Users who are viewing this thread

Top Bottom