Hey yall,
Quite stumped and need a pick me up. My expertise is building but still somewhat limited...but I AM LEARNING!
I have a query, "QRYLOGINEXT" and my login form "FRMLOGIN" and my login button "cmdLogin".
In my query i only have two fields, "Login Name" and "Password".
In my Login form, my two boxes are "cboUser" and "txtPassword".
After that I'm lost. Here is what I have for my "On Click" event...
Private Sub Login_Click()
If IsNull(cboUser) Then
MsgBox "Please type in a valid User Name", vbOKOnly, "Invalid Entry"
End If
If IsNull(txtPassword) Then
MsgBox "Please type in a valid Password", vbOKOnly, "Invalid Entry"
End If
cboUser = Nz(DLookup("Login Name", "QRYLOGINEXT", "Login Name= '" & cboUser & "'"), "")
txtPassword = Nz(DLookup("Password", "QRYLOGINEXT", "Password= '" & txtPassword & "'"), "")
'Validate the User Name and Password exists in the Tbl_Representatives
If UserNamePassword = (cboUser & txtPassword) Then
DoCmd.OpenForm "FrmHome"
DoCmd.Close acForm, "FrmLogin"
Else
MsgBox "Invalid User Name/Password. Please try again.", vbOKOnly, "Invalid Entry"
End If
End Sub
Everytime I click on my Login button, I get an error message. I try to fix what it highlights and whatever I do it doesnt change anything. Any bit of advice can certainly help. Thanks guys.:banghead:
Quite stumped and need a pick me up. My expertise is building but still somewhat limited...but I AM LEARNING!
I have a query, "QRYLOGINEXT" and my login form "FRMLOGIN" and my login button "cmdLogin".
In my query i only have two fields, "Login Name" and "Password".
In my Login form, my two boxes are "cboUser" and "txtPassword".
After that I'm lost. Here is what I have for my "On Click" event...
Private Sub Login_Click()
If IsNull(cboUser) Then
MsgBox "Please type in a valid User Name", vbOKOnly, "Invalid Entry"
End If
If IsNull(txtPassword) Then
MsgBox "Please type in a valid Password", vbOKOnly, "Invalid Entry"
End If
cboUser = Nz(DLookup("Login Name", "QRYLOGINEXT", "Login Name= '" & cboUser & "'"), "")
txtPassword = Nz(DLookup("Password", "QRYLOGINEXT", "Password= '" & txtPassword & "'"), "")
'Validate the User Name and Password exists in the Tbl_Representatives
If UserNamePassword = (cboUser & txtPassword) Then
DoCmd.OpenForm "FrmHome"
DoCmd.Close acForm, "FrmLogin"
Else
MsgBox "Invalid User Name/Password. Please try again.", vbOKOnly, "Invalid Entry"
End If
End Sub
Everytime I click on my Login button, I get an error message. I try to fix what it highlights and whatever I do it doesnt change anything. Any bit of advice can certainly help. Thanks guys.:banghead: