user admin

V

VilMarci

Hi,

I'd like to allow employees to access and update their own data in an Access
database.
Is there any way to retreive the username they use for login with Visual
Basic (or function)?
Here's the story:

User logs in with NT userID & PW as ususal
Launches the .mdb from a shared folder
A script checks the userID (somehow) and opens a form in edit mode filtered
with the userID.

Thanks for your help in advance

VilMarci
 
P

Peter

add this to module
Option Explicit

Public Declare Function GetComputerName Lib "kernel32" Alias
"GetComputerNameA" (ByVal lpBuffer$, nSize As Long) As Long
Public Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA"
(ByVal lpBuffer As String, nSize As Long) As Long

in your code add this
Private Sub cmdGetInfo_Click()
Dim strComputerName As String
Dim strUserName As String

strComputerName = String(512, " ")
strUserName = String(512, " ")

GetComputerName strComputerName, Len(strComputerName)
txtComputerName.Text = Trim(strComputerName)
'MsgBox Str$(Len(strComputerName))

GetUserName strUserName, Len(strUserName)
txtUserName.Text = Trim(strUserName)
'MsgBox Str$(Len(strUserName))
End Sub
 
V

VilMarci

Hi all,

Many thanks for your help.
Now I can build a table with permission sets :)
like

ID,module1,module2,module3
xy,1,1,0

The main thing was to avoid lots of user logins to the same computer

Thanks again,

VilMarci
 

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