A
AB via AccessMonster.com
I have successfully used the code below for a login form in an Access .mdb.
I am now working with an ADP file and the code does not work...
What is needed to use this with an ADP?
we need to have a table defined login vs a sql login
Thanks - AB
----------------------------
code below
Private Sub okButton_Click()
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
If IsNull(Me.txtUserName) Then
MsgBox "Please enter a valid user name.", vbExclamation, "Error"
Me.txtUserName.SetFocus
Exit Sub
End If
rs.Open "SELECT * FROM viewUsers WHERE(UserName = """ & Me.txtUserName &
""")", _
CurrentProject.Connection, adOpenKeyset, adLockOptimistic
If rs.EOF Then
MsgBox "Invalid user name. Please try again.", vbExclamation, "Error"
Me.txtUserName.SetFocus
Exit Sub
End If
MsgBox "Login Successful.", vbInformation, "Confirm!"
Me.Visible = False
Exit Sub
End Sub
I am now working with an ADP file and the code does not work...
What is needed to use this with an ADP?
we need to have a table defined login vs a sql login
Thanks - AB
----------------------------
code below
Private Sub okButton_Click()
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
If IsNull(Me.txtUserName) Then
MsgBox "Please enter a valid user name.", vbExclamation, "Error"
Me.txtUserName.SetFocus
Exit Sub
End If
rs.Open "SELECT * FROM viewUsers WHERE(UserName = """ & Me.txtUserName &
""")", _
CurrentProject.Connection, adOpenKeyset, adLockOptimistic
If rs.EOF Then
MsgBox "Invalid user name. Please try again.", vbExclamation, "Error"
Me.txtUserName.SetFocus
Exit Sub
End If
MsgBox "Login Successful.", vbInformation, "Confirm!"
Me.Visible = False
Exit Sub
End Sub