Advertisement

04.28.2008 at 02:54AM PDT, ID: 23358186
[x]
Attachment Details

Remember Username from MS Access Login

Asked by paganji in Access Forms, VB Script

I have a working login form in Microsoft access. When the user logs in successfully, they are presented with a splash screen that will be the main menu for the database. When saving new records in the database, I want to record the username of who saved the record. To do this I need the database to determine the username that is currently logged in.

I am a beginner and having some difficulty figuring this out.

I have a single table containing erccID strUsername strPassword
The login form has a combo box which selects the usernames using a query
When they enter username and password, the script is run, I have attached some of the code.
When I try to display the username on the main menu form, it just displays the userID for the person logged in, and not the username which I would prefer.Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
'Check value of password in tblErccUsers to see if this matches value chosen in combo box
 
    If Me.txtPassword.Value = DLookup("strPassword", "tblErccUsers", "[erccID]=" & Me.cboUsername.Value) Then
 
        erccMyID = Me.cboUsername.Value
 
'Close logon form and open splash screen
        
        DoCmd.Close acForm, "frmLogon", acSaveNo
        DoCmd.OpenForm "frmSplash_Screen"
 
        Else
        MsgBox "Password Invalid.  Please Try Again", vbOKOnly, "Invalid Entry!"
        Me.txtPassword.SetFocus
    End If
[+][-]04.28.2008 at 04:53AM PDT, ID: 21453075

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Access Forms, VB Script
Sign Up Now!
Solution Provided By: peter57r
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628