Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Type Mismatch in Password form

Status
Not open for further replies.

jstoto

IS-IT--Management
May 7, 2002
4
US

Below is the code for my cmdOK box in a form called Password. I have a tbl called Security that Password reads the username and password from to validate. In the form I have two text fields called Username and Password and 2 cmd buttons called cmdOK and cmdCancel. In the table there are 3 entries called userID (number field PK), username and password as text fields. My problem is that I am getting a type mismatch error when I click OK. when I debug it points to the line starting with SecTB= Can someone help me please?

*********************************
Private Sub cmdOK_Click()
Dim Curdb As Database, SQLStmt As String, SecTB As Recordset

Set Curdb = CurrentDb() 'If your table and form are in same database other wise change it

SQLStmt = "SELECT * FROM [Security] WHERE [UserName] = '" & Trim("" & Me![txtUsername]) & "'"
SQLStmt = SQLStmt & " AND [Password] = '" & Trim("" & Me![txtPassword]) & "'"

Set SecTB = Curdb.OpenRecordset(SQLStmt, DB_OPEN_DYNASET)
If SecTB.EOF Then
MsgBox "Logon ID or Password not found!", 16, "Incorrect Logon Information"
SecTB.Close
Exit Sub
End If

SecTB.Close
DoCmd.OpenForm "frmExecutives"
DoCmd.Close A_FORM, "Password"
Forms![frmExecutives].SetFocus
End Sub
**********************************
Thank you for all help
 
I fixed this by moving DAO 3.6 up the chain under tools->preferences. Thank you all
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top