Hey Everyone
I am writing an electronic diary appliacation of which the backend is done is sql and the front end is acces. I have created a form for users to login so they are able to keep their diaries private. However on the click event of the logon button i keep getting the error "Two few Parameters Expected 1 Error"
Here is the code:
The code crashes here:
Any help would be great thanks
I am writing an electronic diary appliacation of which the backend is done is sql and the front end is acces. I have created a form for users to login so they are able to keep their diaries private. However on the click event of the logon button i keep getting the error "Two few Parameters Expected 1 Error"
Here is the code:
Code:
Private Sub cmdLogonLogon_Click()
On Error GoTo Err_cmdLogonLogon_Click
Dim stDocName As String
Dim stLinkCriteria As String
Dim sql As String
Dim username As String
Dim pass As String
Dim getPassword As String
Me.txtUsername.SetFocus
getUsername = Me.txtUsername.Text
Me.txtPassword.SetFocus
password = Me.txtPassword.Text
Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Dim strSQL As String
Me.txtUsername.SetFocus
strSQL = "SELECT Password FROM dbo_tblUsers WHERE Username = " & Me.txtUsername & ";"
Set dbs = CurrentDb()
Set rst = dbs.OpenRecordset(strSQL, dbOpenDynaset)
If rst.RecordCount = 0 Then
MsgBox "No Data Available"
Exit Sub
End If
rst.MoveLast
rst.MoveFirst
getPass = rst![password]
If password = getPassword Then
rst.Close
stDocName = "frmUser_Control_Pannel"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Else
MsgBox ("Error: Username or password is incorrect.")
Exit Sub
End If
Exit_cmdLogonLogon_Click:
Exit Sub
Err_cmdLogonLogon_Click:
MsgBox Err.Description
Resume Exit_cmdLogonLogon_Click
End Sub
The code crashes here:
Set rst = dbs.OpenRecordset(strSQL, dbOpenDynaset)
Any help would be great thanks