Hiya,
Newbie here.
I am using the Login screen described in this article. and it works fine.
since I am on a domain network, I also added 2 text boxes to display the Username and Computername. Me.txtUser = Environ("UserName") and Me.txtComp = Environ("ComputerName"). which also work fine.
Now, what I've been trying to do is to automatically match the Environment Username with a username selection from the combo box.
ie: if the Envir Username is e09115 I want the default value for the combo box for cboEmployee to be set to User1, and so forth.
I've tried doing something like:
Private Sub Form_Load()
Me.txtUser.SetFocus
Me.txtUser = Environ("UserName")
Me.txtPassword.SetFocus
End Sub
Private Sub txtUser_LostFocus()
If IsNull(Me!txtUser) Or Len(Me!txtUser) < 1 Then
Me!cboEmployee = ""
ElseIf Me!txtUser = "e09115" Then Me!cboEmployee= "User1"
ElseIf Me!txtUser = "e05872" Then Me!cboEmployee = "User2"
Else
Me!cboEmployee = "Unknown User"
End If
End Sub
But this did nothing.
I'm not sure what's wrong, maybe its because cboEmployee has 2 columns and the first column is hidden? that's why it doesn't set the value? I really don't know.
I've been tryin to make this work all morning and here I am 5 hours later, desperate.
I just newly starting learning Access and Ive come to a dead end. Any help would be much appreciated.
Thank you.