hi .. when i'm running this code. i'm getting this error.. "No value given for one or more required parameters." i have two text boxes in my form with name as username & password . and just a command button. the table is patron with cardnumber and password as fields in it.
here is the code.. plz help..
Private Sub Command9_Click()
On Error GoTo Err_Command9_Click
Dim con As Object
Dim rs As Object
Dim stSql As String
Set con = Application.CurrentProject.Connection
stSql = "SELECT * FROM [Patron]"
stSql = stSql & " WHERE [CardNumber]= Forms!test1!usernumber & [Password] = Forms!test1!password;"
Set rs = CreateObject("ADODB.Recordset")
rs.Open stSql, con, 1 ' 1 = adOpenKeyset
If (rs.EOF) Then
MsgBox "Command not available."
Else
MsgBox "Command available."
End If
rs.Close
Set rs = Nothing
Set con = Nothing
Exit_Command9_Click:
Exit Sub
Err_Command9_Click:
MsgBox Err.Description
Resume Exit_Command9_Click
End Sub
to
WHERE [CardNumber]= " & Me.usernumber & " [Password] = '" & Me.password & "';"
i have assumed usernumber is a number not text (in table data type)
Dave