How to To log data entry form user name in MS Access database using VBA

siamandm
BronzeLounger
Posts: 1227
Joined: 01 May 2016, 09:58

How to To log data entry form user name in MS Access database using VBA

Post by siamandm »

Hello All,

if I have a login form, to login to a database which multiple users are using it...
how to log the user name for the new records inserted or modified by this user with the time stamp using VBA codes


Regards
Siyamand

User avatar
HansV
Administrator
Posts: 78488
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: How to To log data entry form user name in MS Access database using VBA

Post by HansV »

Do you keep the login form open? If not, do you store the login name somewhere?
Best wishes,
Hans

siamandm
BronzeLounger
Posts: 1227
Joined: 01 May 2016, 09:58

Re: How to To log data entry form user name in MS Access database using VBA

Post by siamandm »

We have a table for the username and password which use for login to the database
The form will be closed after success login

User avatar
HansV
Administrator
Posts: 78488
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: How to To log data entry form user name in MS Access database using VBA

Post by HansV »

How do we know the username when the login form has been closed?
Best wishes,
Hans

siamandm
BronzeLounger
Posts: 1227
Joined: 01 May 2016, 09:58

Re: How to To log data entry form user name in MS Access database using VBA

Post by siamandm »

Im not sure but usually when you login to a system the login screen disappear, it will be closed or minimized?

User avatar
HansV
Administrator
Posts: 78488
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: How to To log data entry form user name in MS Access database using VBA

Post by HansV »

If you want to log the username, we have to know the username...
Best wishes,
Hans

siamandm
BronzeLounger
Posts: 1227
Joined: 01 May 2016, 09:58

Re: How to To log data entry form user name in MS Access database using VBA

Post by siamandm »

So what you advise?

User avatar
HansV
Administrator
Posts: 78488
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: How to To log data entry form user name in MS Access database using VBA

Post by HansV »

You have to store the username somewhere, for example a text box on a form that remains open, or in a table...
Best wishes,
Hans

siamandm
BronzeLounger
Posts: 1227
Joined: 01 May 2016, 09:58

Re: How to To log data entry form user name in MS Access database using VBA

Post by siamandm »

Aha so we can put a label that shows the logged in user name

User avatar
HansV
Administrator
Posts: 78488
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: How to To log data entry form user name in MS Access database using VBA

Post by HansV »

That's one possibility.

Do you want to log the username and timestamp in each table itself, or do you want to use a separate table that contains these data for all tables that you want to log?
Best wishes,
Hans

siamandm
BronzeLounger
Posts: 1227
Joined: 01 May 2016, 09:58

Re: How to To log data entry form user name in MS Access database using VBA

Post by siamandm »

I believe the second option os more practical having one table for users log

Regards

User avatar
HansV
Administrator
Posts: 78488
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: How to To log data entry form user name in MS Access database using VBA

Post by HansV »

Best wishes,
Hans