(MS Access)
I am capable of filtering the user when logging in to windows with this in the module:
Private Declare Function WNetGetUserA Lib "mpr" _
(ByVal lpName As String, ByVal lpUserName As _
String, lpnLength As Long) As Long
Function GetUser() As String
Dim sUserNameBuff As String * 255
sUserNameBuff = Space(255)
Call WNetGetUserA(vbNullString, sUserNameBuff, 255&)
GetUser = Left$(sUserNameBuff, InStr(sUserNameBuff, _
vbNullChar) - 1)
and this in the on open event on the form:
Private Sub Form_Open(Cancel As Integer)
Usr = GetUser()
If Usr <> "xxx" Or Usr <> "xxx" Or Usr <> "xxx" Then
Application.SetOption "Show Hidden Objects", False
End If
If Usr = "xxx" Or Usr = "xxx" Or Usr = "xxx" Or Usr = "xxx" Then
Usr = InputBox("Enter User Name", "Test", Usr)
End If
cmdFind.Visible = True
end sub
What I need to do is match userLogin with empNo(primary key) which these fields are in the same table. The way i need it is that when the user logs in the form only displays that particular empNo records and no others...Makes sense...I just don't know what the code would be like. Please if any of you guru's can help I would appreciate it. Thank You
I am capable of filtering the user when logging in to windows with this in the module:
Private Declare Function WNetGetUserA Lib "mpr" _
(ByVal lpName As String, ByVal lpUserName As _
String, lpnLength As Long) As Long
Function GetUser() As String
Dim sUserNameBuff As String * 255
sUserNameBuff = Space(255)
Call WNetGetUserA(vbNullString, sUserNameBuff, 255&)
GetUser = Left$(sUserNameBuff, InStr(sUserNameBuff, _
vbNullChar) - 1)
and this in the on open event on the form:
Private Sub Form_Open(Cancel As Integer)
Usr = GetUser()
If Usr <> "xxx" Or Usr <> "xxx" Or Usr <> "xxx" Then
Application.SetOption "Show Hidden Objects", False
End If
If Usr = "xxx" Or Usr = "xxx" Or Usr = "xxx" Or Usr = "xxx" Then
Usr = InputBox("Enter User Name", "Test", Usr)
End If
cmdFind.Visible = True
end sub
What I need to do is match userLogin with empNo(primary key) which these fields are in the same table. The way i need it is that when the user logs in the form only displays that particular empNo records and no others...Makes sense...I just don't know what the code would be like. Please if any of you guru's can help I would appreciate it. Thank You