hello im new to access code so i have a login form and a user table that have the usernames , passwords and user full name and in my login form i have login button with this code:
so my question is how can i show my user full name after he login and goes to main form ? can i use tempvar? and how to use it?
Code:
Option Compare Database
Private Sub cmdlog_Click()
If IsNull(Form_frmlogin.txtuser) Then
MsgBox "enter user", vbInformation, "adam vorood"
Me.txtuser.SetFocus
Me.txtuser.BackColor = vbYellow
ElseIf IsNull(Form_frmlogin.txtpass) Then
MsgBox "enter pass", vbInformation, "adam vorood"
Me.txtpass.SetFocus
Me.txtpass.BackColor = vbYellow
ElseIf IsNull(DLookup("userName", "tbluser", "userName='" & Form_frmlogin.txtuser.Value & "' and userPass='" & Form_frmlogin.txtpass.Value & "'")) Then
MsgBox "nam ya ramz ghalate", vbInformation, "khata"
Else
DoCmd.OpenForm "frmmain"
DoCmd.Close acForm, "frmlogin", acSaveYes
End If
End Sub