HELP - Selet Statement not working, Run-time error '3075'

  • Thread starter Thread starter Trini Gal
  • Start date Start date
T

Trini Gal

Can someone help me figure out why this is happening please?

I'm getting an error:

Syntax error (missing operator) in query expression 'TitleID=43AND
strPassword="GA3'

in the following code:

Private Sub txtTitleRP1Password_AfterUpdate()

Dim rst As DAO.Recordset

If Trim(Me.txtTitleRP1Password & "") = "" Then
Me.txtTitleRP1 = ""
Me.txtTitleRP1.SetFocus
Else

Set rst = CurrentDb.OpenRecordset( _
"SELECT Title From tblTitle " & _
"WHERE TitleID= " & Me.cmdTitleRP1 & _
"AND strPassword= """ & Me.txtTitleRP1Password)


If Not (rst.EOF And rst.BOF) Then
Me.txtTitleRP1 = rst("Title") 'populate the textboxes
Else
Me.txtTitleRP1 = ""
Me.txtTitleRP1.SetFocus
End If

Set rst = Nothing

End If

End Sub
 
Trini said:
Can someone help me figure out why this is happening please?

I'm getting an error:

Syntax error (missing operator) in query expression 'TitleID=43AND
strPassword="GA3'

in the following code:

Private Sub txtTitleRP1Password_AfterUpdate()

Dim rst As DAO.Recordset

If Trim(Me.txtTitleRP1Password & "") = "" Then
Me.txtTitleRP1 = ""
Me.txtTitleRP1.SetFocus
Else

Set rst = CurrentDb.OpenRecordset( _
"SELECT Title From tblTitle " & _
"WHERE TitleID= " & Me.cmdTitleRP1 & _
"AND strPassword= """ & Me.txtTitleRP1Password)


Add a space before the AND
 
Back
Top