Wiz47
Learning by inches ...
- Local time
- Today, 07:24
- Joined
- Nov 30, 2006
- Messages
- 274
Okay, here goes:
1. Rename your module basCurrentUser as you can't have the module name the same name as the variable.
2. In the Click event of the button on your login form add the part in red:
Code:'Check value of password in tblEmployees to see if this 'matches value chosen in combo box If Me.Text6.Value = DLookup("Password", "Staff", _ "[Staff ID]=" & Me.Combo2.Value) Then staffID = Me.Combo2.Value [B][COLOR="Red"] CurrentUser = DLookup("[First Name]", "Staff", "[Staff ID]=" & Me.Combo2) CurrentUser = CurrentUser & " " & DLookup("[Surname]", "Staff", "[Staff ID]=" & Me.Combo2)[/COLOR][/B] 'Close logon form and open splash screen DoCmd.Close acForm, "LoginForm", acSaveNo DoCmd.OpenForm "Splash" Else MsgBox "Password Invalid. Please Try Again", vbOKOnly, "Invalid Entry!" Me.Text6.SetFocus End If
3. Add this to the On Load event of your Splash (which isn't really a splash form - a splash is something that comes up and shows a logo, or information about the program, and then goes away):
Code:Me.Text13 = CurrentUser
I went about it a slightly different way, Bob. I added the public variable on the afterUpdate of the login then used that on the currentEvent of the form to put the name in the textbox. My method doesn't do a check for a match, it just mimics the name assigned to the combo then transfers it to the other form. Your way might well be better.