From: Trini Gal on
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

From: Marshall Barton on
Trini Gal wrote:

>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

--
Marsh
MVP [MS Access]