finding a name on list

  • Thread starter John Webb via AccessMonster.com
  • Start date
J

John Webb via AccessMonster.com

Afraid I don't know the answer to your query, but I thought I would point
out another possible problem. What if the persons surname is something
like O'Shea.

Try the following code, should correct your problem and make sure names
with apostrophes don't mess you about:

***CODE BEGINS***

Dim strSQL as string

strSQL = "CustomerName LIKE " & chr(34) & Me.TextBox & chr(34)
Me.RecordsetClone.FindFirst strSQL

***CODE ENDS***

UNTESTED, but I think it should work

Cheers

John Webb
 
J

John Webb via AccessMonster.com

oops, slight correction:

***CODE BEGINS***

Dim strSQL as string

strSQL = "CustomerName LIKE " & chr(34) & Me.TextBox & "*" & chr(34)
Me.RecordsetClone.FindFirst strSQL

***CODE ENDS***
 
S

Sam

i have a form with a list of customers
for finding a name on the list user write's the name in a text box
the code i'm using is:
Private Sub TextBox_KeyUp(KeyCode As Integer, Shift As Integer)
Recalc
Screen.ActiveControl.OnKeyUp = ""
SendKeys "{F2}", True 'Press F2 (Goto end of text line)
TextBox.OnKeyUp = "[Event Procedure]" 'Restore Event
'
Me.RecordsetClone.FindFirst "left([CustomerName]," & Len(TextBox) & ")
= '" & Me!TextBox & "'"
Me.Bookmark = Me.RecordsetClone.Bookmark

End Sub


while user write's the last name it's working ok
but when entering space between last name and first name, space disapears
and name can't be found

have an idea?

thanks
sam
 

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

Top