Log name of user of database...

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.
 

Attachments

There are a lot of ways that it can be done. So, no big thing. Whatever works...
 
There are a lot of ways that it can be done. So, no big thing. Whatever works...

That's true, but I tend to bow to your expertise in Access. :)
 
In this case, I just modified the base stuff of what was already there instead of going too far off the path he had gone down; was more for simplicity's sake than anything.
 
In this case, I just modified the base stuff of what was already there instead of going too far off the path he had gone down; was more for simplicity's sake than anything.

Of course, that makes sense.
 
hey, i managed to sort out the problem i was having thanks to you guys! You've all been a great help. There are other problems i have but these arent concerning forms but rather reports =P but im sure i can figure it out. So yeah, many thanks to you guys! =) I'll know where to come when i have another problem!
 

Users who are viewing this thread

Back
Top Bottom