Connecting Tech Pros Worldwide Help | Site Map

rs.FindFirst question

  #1  
Old November 13th, 2005, 03:57 PM
Shyguy
Guest
 
Posts: n/a
Is there a way to use this when entries have an apostrphe in them?

Like Joe's Bar and Grill.
  #2  
Old November 13th, 2005, 03:57 PM
Tom van Stiphout
Guest
 
Posts: n/a

re: rs.FindFirst question


On Wed, 26 Oct 2005 00:02:06 -0400, Shyguy <shyguy@aol.com> wrote:

Yes: double-up on them:
rs.FindFirst "LastName='O''Brien"

-Tom.

[color=blue]
>Is there a way to use this when entries have an apostrphe in them?
>
>Like Joe's Bar and Grill.[/color]

  #3  
Old November 13th, 2005, 03:57 PM
lylefair
Guest
 
Posts: n/a

re: rs.FindFirst question


I think your answer is correct.

  #4  
Old November 13th, 2005, 03:57 PM
Shyguy
Guest
 
Posts: n/a

re: rs.FindFirst question


On Tue, 25 Oct 2005 21:21:06 -0700, Tom van Stiphout
<no.spam.tom7744@cox.net> wrote:
[color=blue]
>On Wed, 26 Oct 2005 00:02:06 -0400, Shyguy <shyguy@aol.com> wrote:
>
>Yes: double-up on them:
>rs.FindFirst "LastName='O''Brien"
>
>-Tom.
>
>[color=green]
>>Is there a way to use this when entries have an apostrphe in them?
>>
>>Like Joe's Bar and Grill.[/color][/color]


Thank you for the reply.

I guess there are other ways to use "rs.FindFirst" . ;-( I am using it
behind a combo box and the full line is -

rs.FindFirst "[Organization] = '" & Me![cboOrg] & "'"

Some of the names hgave an apostrophe but some don't. The ones that
don't work fine. When one is selected that has an apostrophe I get a
runtime error 3077 and syntax error (missing operator) in expression.
  #5  
Old November 13th, 2005, 03:57 PM
Tim Marshall
Guest
 
Posts: n/a

re: rs.FindFirst question


Shyguy wrote:
[color=blue]
> I guess there are other ways to use "rs.FindFirst" . ;-( I am using it
> behind a combo box and the full line is -
>
> rs.FindFirst "[Organization] = '" & Me![cboOrg] & "'"[/color]

Don't mean to jump in on Tom, but don't use the single quotes where
you're using them now. Do this:

rs.FindFirst "[Organization] = """ & Me![cboOrg]) & """"

Or, as doubling up on double quotes can get hard to keep track of for
long strings (the chr(34) is a ":

rs.FindFirst "[Organization] = " & chr(34) & Me![cboOrg]) & chr(34)

--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me
  #6  
Old November 13th, 2005, 03:57 PM
Shyguy
Guest
 
Posts: n/a

re: rs.FindFirst question


On Wed, 26 Oct 2005 14:56:41 -0230, Tim Marshall
<TIMMY!@PurplePandaChasers.Moertherium> wrote:
[color=blue]
>Shyguy wrote:
>[color=green]
>> I guess there are other ways to use "rs.FindFirst" . ;-( I am using it
>> behind a combo box and the full line is -
>>
>> rs.FindFirst "[Organization] = '" & Me![cboOrg] & "'"[/color]
>
>Don't mean to jump in on Tom, but don't use the single quotes where
>you're using them now. Do this:
>
>rs.FindFirst "[Organization] = """ & Me![cboOrg]) & """"
>
>Or, as doubling up on double quotes can get hard to keep track of for
>long strings (the chr(34) is a ":
>
>rs.FindFirst "[Organization] = " & chr(34) & Me![cboOrg]) & chr(34)[/color]


Thank you very much. It worked fine, after I removed the extra )
;-)
  #7  
Old November 13th, 2005, 03:58 PM
Trevor Best
Guest
 
Posts: n/a

re: rs.FindFirst question


Shyguy wrote:[color=blue]
>
> Thank you very much. It worked fine, after I removed the extra )
> ;-)[/color]

Until you get one with a double quote in it, say the organisation is the
over 6'5" club :-)

Try:
rs.FindFirst "[Organization] = '" & Replace(Me![cboOrg]"'","''") & "'"
Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
FindFirst fails on indexed field Rick Collard answers 25 June 27th, 2008 08:25 PM
Another Multiple Combo box Question teric2 answers 16 June 27th, 2007 11:36 PM
Object Variable question yamafopa answers 2 November 12th, 2005 07:46 PM
Error-trapping question Pete answers 8 November 12th, 2005 02:33 PM