473,396 Members | 2,129 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Combo Box error with apostrophe

Today's problem is - my combo box works great until it comes across a name
with an apostrophe, such as Bill's Bike Shop. I'm sure this is very common
problem and I'm sure the work around is very simple. But danged if I can
find it. Thanks for your help.
Becky
Nov 15 '06 #1
7 3298

Rebecca Smith wrote:
Today's problem is - my combo box works great until it comes across a name
with an apostrophe, such as Bill's Bike Shop. I'm sure this is very common
problem and I'm sure the work around is very simple. But danged if I can
find it. Thanks for your help.
Becky
What exactly is the problem?

Bruce

Nov 15 '06 #2
On Wed, 15 Nov 2006 10:09:40 -0800, Rebecca Smith wrote:
Today's problem is - my combo box works great until it comes across a name
with an apostrophe, such as Bill's Bike Shop. I'm sure this is very common
problem and I'm sure the work around is very simple. But danged if I can
find it. Thanks for your help.
Becky
Rebecca,
It's easier to 'fix' if you post your exact combo box RowSource SQL.
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
Nov 15 '06 #3
The Row Source is tblCommercialMembers and event is:

Private Sub cboCompanyName_AfterUpdate()
' Find the record that matches the control.
With Me
.RecordsetClone.FindFirst "[CompanyName] = '" & Me![cboCompanyName]
& "'"
.Bookmark = Me.RecordsetClone.Bookmark
End With

Thank,
R.
"fredg" <fg******@example.invalidwrote in message
news:14******************************@40tude.net.. .
On Wed, 15 Nov 2006 10:09:40 -0800, Rebecca Smith wrote:
>Today's problem is - my combo box works great until it comes across a
name
with an apostrophe, such as Bill's Bike Shop. I'm sure this is very
common
problem and I'm sure the work around is very simple. But danged if I can
find it. Thanks for your help.
Becky

Rebecca,
It's easier to 'fix' if you post your exact combo box RowSource SQL.
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail

Nov 15 '06 #4
On Wed, 15 Nov 2006 10:43:13 -0800, "Rebecca Smith"
<re************@comcast.netwrote:

The apostrophe is a string terminator. So it would try to FindFirst
CompanyName = 'Bill'
You have to double up on those characters, for example with the
Replace function:
..RecordsetClone.FindFirst "[CompanyName] = '" &
Replace(Me![cboCompanyName],"'", "''")
& "'"

-Tom.

>The Row Source is tblCommercialMembers and event is:

Private Sub cboCompanyName_AfterUpdate()
' Find the record that matches the control.
With Me
.RecordsetClone.FindFirst "[CompanyName] = '" & Me![cboCompanyName]
& "'"
.Bookmark = Me.RecordsetClone.Bookmark
End With

Thank,
R.
"fredg" <fg******@example.invalidwrote in message
news:14******************************@40tude.net. ..
>On Wed, 15 Nov 2006 10:09:40 -0800, Rebecca Smith wrote:
>>Today's problem is - my combo box works great until it comes across a
name
with an apostrophe, such as Bill's Bike Shop. I'm sure this is very
common
problem and I'm sure the work around is very simple. But danged if I can
find it. Thanks for your help.
Becky

Rebecca,
It's easier to 'fix' if you post your exact combo box RowSource SQL.
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
Nov 15 '06 #5
On Wed, 15 Nov 2006 11:54:12 -0700, Tom van Stiphout
<no*************@cox.netwrote:

Better still:
Make your combobox a 2-column dropdown, with a hidden CustomerID, and
then search by that number.

-Tom.

>On Wed, 15 Nov 2006 10:43:13 -0800, "Rebecca Smith"
<re************@comcast.netwrote:

The apostrophe is a string terminator. So it would try to FindFirst
CompanyName = 'Bill'
You have to double up on those characters, for example with the
Replace function:
.RecordsetClone.FindFirst "[CompanyName] = '" &
Replace(Me![cboCompanyName],"'", "''")
& "'"

-Tom.

>>The Row Source is tblCommercialMembers and event is:

Private Sub cboCompanyName_AfterUpdate()
' Find the record that matches the control.
With Me
.RecordsetClone.FindFirst "[CompanyName] = '" & Me![cboCompanyName]
& "'"
.Bookmark = Me.RecordsetClone.Bookmark
End With

Thank,
R.
"fredg" <fg******@example.invalidwrote in message
news:14******************************@40tude.net ...
>>On Wed, 15 Nov 2006 10:09:40 -0800, Rebecca Smith wrote:

Today's problem is - my combo box works great until it comes across a
name
with an apostrophe, such as Bill's Bike Shop. I'm sure this is very
common
problem and I'm sure the work around is very simple. But danged if I can
find it. Thanks for your help.
Becky

Rebecca,
It's easier to 'fix' if you post your exact combo box RowSource SQL.
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
Nov 15 '06 #6
Works exquisitely - thanks tons!
B.

"Tom van Stiphout" <no*************@cox.netwrote in message
news:pe********************************@4ax.com...
On Wed, 15 Nov 2006 10:43:13 -0800, "Rebecca Smith"
<re************@comcast.netwrote:

The apostrophe is a string terminator. So it would try to FindFirst
CompanyName = 'Bill'
You have to double up on those characters, for example with the
Replace function:
.RecordsetClone.FindFirst "[CompanyName] = '" &
Replace(Me![cboCompanyName],"'", "''")
& "'"

-Tom.

>>The Row Source is tblCommercialMembers and event is:

Private Sub cboCompanyName_AfterUpdate()
' Find the record that matches the control.
With Me
.RecordsetClone.FindFirst "[CompanyName] = '" &
Me![cboCompanyName]
& "'"
.Bookmark = Me.RecordsetClone.Bookmark
End With

Nov 15 '06 #7
On Wed, 15 Nov 2006 10:43:13 -0800, Rebecca Smith wrote:
The Row Source is tblCommercialMembers and event is:

Private Sub cboCompanyName_AfterUpdate()
' Find the record that matches the control.
With Me
.RecordsetClone.FindFirst "[CompanyName] = '" & Me![cboCompanyName]
& "'"
.Bookmark = Me.RecordsetClone.Bookmark
End With

Thank,
R.

"fredg" <fg******@example.invalidwrote in message
news:14******************************@40tude.net.. .
>On Wed, 15 Nov 2006 10:09:40 -0800, Rebecca Smith wrote:
>>Today's problem is - my combo box works great until it comes across a
name
with an apostrophe, such as Bill's Bike Shop. I'm sure this is very
common
problem and I'm sure the work around is very simple. But danged if I can
find it. Thanks for your help.
Becky

Rebecca,
It's easier to 'fix' if you post your exact combo box RowSource SQL.
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
In addition to Tom's comments, this too will work:

Me.RecordsetClone.FindFirst "[CompanyName] = """ & Me![cboCompanyName]
& """"
as will this:

Me.RecordsetClone.FindFirst "[CompanyName] = " & chr(34) &
Me![cboCompanyName] & chr(34)

But his suggestion of searching by CompanyID is best.
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
Nov 15 '06 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Jack | last post by:
Hi, I am trying to test a sql statement in Access which gives me the error as stated in the heading. The sql statement is built as a part of asp login verification, where the userid and password...
2
by: CSDunn | last post by:
Hello, I have a combo box designed to look up records in a subform based on the selection made in the combo box. The Record Source for the combo box is a SQL Server 2000 View. There is one bound...
10
by: DataBard007 | last post by:
Hello Access Gurus: I use Win98SE and Access97. I just built a simple Access97 application which holds all contact information for my personal contacts, such as first name, last name, address,...
10
by: Bhavna | last post by:
I am using a Replace function to replace single quotes with double when submitting a text field in the database i.e. Replace (q, "'", "' ' ") which works fine. When I retrieve the field from the...
7
by: abilashnn | last post by:
Dear All, In one of my appln, I have one pop up window which will select one name from the list and return to calling jsp page. Now one name eg: Kevin O' Connor , having apostrophe. So if we...
2
by: ielamrani | last post by:
Hi, I created a combo box to filter client name. The combo box is working fine except on this case: when I filter one of these name: David's Financial or Rao's Specialty I get this error: ...
0
sashi
by: sashi | last post by:
Apostrophe Have you ever tried to send a string variable to MS Access that had apostrophes embedded within an SQL Statement? If YES you will get a run time ERROR. Here is your solution, a function...
0
by: snowdream1982 | last post by:
Dear all, I hit an error OVERFLOW but when I insert the sql statement below manually in the SQLEditor, it goes well, no errors at all. My coding: SQLInsertTempMf = "INSERT INTO tempmf " &...
9
by: Thomas 'PointedEars' Lahn | last post by:
Jukka K. Korpela wrote: IBTD. For example, in English it is customary (and AIUI expected) to use the character that ’ represents should be used to delimit a quotation within direct speech...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.