Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combo box error with unusual name

Status
Not open for further replies.

GaborH

Technical User
Nov 5, 2003
48
US
This is likely a simple problem, but this novice is clueless.

I have a drop down box, whereby an employee is selected by last name, and all associated projects are listed in the resulting query. All seemed to work well, until an employee with the name D’souza was selected. I checked, and this is the correct spelling of the name. The single quotation mark within the name closes the statement and results in an error.

Can someone suggest a way around this?

Any hints and tips are highly appreciated. Thank you.

Here is the code.


Private Sub Combo7_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[Name] = '" & Me![Combo7] & "'"
Me.Bookmark = rs.Bookmark
End Sub
 
I think wrapping the string with the single quote inside a pair of double quotes will fix your problem:

Code:
 rs.FindFirst "[Name] = '" & """" & Me![Combo7] & """" & "'"


< M!ke >
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top