Combo box doesn't search last names with apostrophe

N

Nika

My combo box doesn't search last names with apostrophe in Access 2007. I have
the following code. Please see below. Can somebody help me?
Thanks.

Private Sub Combo384_AfterUpdate()
Dim rs As DAO.Recordset
Dim strWhere As String

If Me.Dirty Then Me.Dirty = False
Set rs = Me.RecordsetClone
strWhere = "[LAST NAME] = """ & Me![Combo384] & """"
rs.FindFirst strWhere
If rs.NoMatch Then
MsgBox "Not found"
Else
Me.Bookmark = rs.Bookmark
End If
Set rs = Nothing
End Sub
 
N

NTC

are you saying this code searches regular names correctly? i.e

Smith

but will not find:

O'Smith

(presuming such a name exists) ??

It is not clear what you mean by your question....
 
J

John W. Vinson

My combo box doesn't search last names with apostrophe in Access 2007. I have
the following code. Please see below. Can somebody help me?
Thanks.

Private Sub Combo384_AfterUpdate()
Dim rs As DAO.Recordset
Dim strWhere As String

If Me.Dirty Then Me.Dirty = False
Set rs = Me.RecordsetClone
strWhere = "[LAST NAME] = """ & Me![Combo384] & """"
rs.FindFirst strWhere
If rs.NoMatch Then
MsgBox "Not found"
Else
Me.Bookmark = rs.Bookmark
End If
Set rs = Nothing
End Sub

That's odd. You're correctly delimiting the string with doublequotes, not
singlequotes. What is the RowSource of Combo384 (post the SQL)? What is the
Bound Column? Is [LAST NAME] perhaps a <yuck, ptoooie!!> Lookup Field in your
table?
 

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