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

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
 
M

Marshall Barton

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top