Small issue in attached DB (1 Viewer)

Ossama22

Registered User.
Local time
Today, 09:38
Joined
Aug 31, 2018
Messages
52
Hello Guys ,
i have this small database with a users table and form , also account numbers form ,

all i need is a tool in (Acc Number query & Dimmed Acc Number ) Forms in Cells ( Entered by & Modified by ) shows which user has entered or modified account numbers

i attach the database to be more specific and thanks in advance .
 

Attachments

  • Database16.accdb
    832 KB · Views: 55

June7

AWF VIP
Local time
Yesterday, 22:38
Joined
Mar 9, 2014
Messages
5,499
VBA code can use Environ("USERNAME") to grab the user Windows login username.
You could grab this value when user first opens db, assuming the same user logged into the computer is also running the Access file. If not, implement a login procedure for the Access database. This is all a very common topic.
 

Ossama22

Registered User.
Local time
Today, 09:38
Joined
Aug 31, 2018
Messages
52
VBA code can use Environ("USERNAME") to grab the user Windows login username.
You could grab this value when user first opens db, assuming the same user logged into the computer is also running the Access file. If not, implement a login procedure for the Access database. This is all a very common topic.

Thanks bro for your response , could you give me a specific code to copy it , because iam a beginner user in access
 

June7

AWF VIP
Local time
Yesterday, 22:38
Joined
Mar 9, 2014
Messages
5,499
You already have a login process. I don't want to build db nor write a bunch of code for you. This can get rather involved. There are many discussions on this topic. Do research and write code to suit your environment. Basically, need to save the user info somewhere so code can reference when needed. Options:

1. populate a textbox on a form that never closes such as MainMenu (I use this approach http://www.accessforums.net/showthread.php?t=23585)

2. use global declared variable

3. use TempVars
 
Last edited:

essaytee

Need a good one-liner.
Local time
Today, 16:38
Joined
Oct 20, 2008
Messages
512
You could also use the scripting method:
Code:
    strUserName = CreateObject("WScript.Network").UserName
    strMachineName = CreateObject("WScript.Network").ComputerName

How I approach this, wrap the above snippets of code into a function (a function for each) with the return value the UserName or MachineName and call the function where ever required. The function should be public, in a module, not in the code-behind-the-form module, especially if you want to call the function from different forms.
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 23:38
Joined
Oct 29, 2018
Messages
21,563
You could also use the scripting method:
Code:
    strUserName = CreateObject("WScript.Network").UserName
    strMachineName = CreateObject("WScript.Network").ComputerName
How I approach this, wrap the above snippets of code into a function (a function for each) with the return value the UserName or MachineName and call the function where ever required. The function should be public, in a module, not in the code-behind-the-form module, especially if you want to call the function from different forms.
I agree, and here are a couple of examples: Username and ComputerName.
Cheers!
 

Users who are viewing this thread

Top Bottom