INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Findfirst fails because data item has double quotes inside quotes.....
2

Findfirst fails because data item has double quotes inside quotes.....

Findfirst fails because data item has double quotes inside quotes.....

(OP)
I am running a find first and getting a syntax error on one of the values in the table.
The data item is Gilette "Boston" Stadium. For background, it dealing with expense items, so someone took someone to a game
and entered in Gilette "Boston" Stadium... but my findfirst is failing because of the double quotes.....how would I code this?

thanks

RE: Findfirst fails because data item has double quotes inside quotes.....

FindFirst based on what?

Please post your SQL.

RE: Findfirst fails because data item has double quotes inside quotes.....

(OP)

Background
------------
They have an expenses table and a table containing searching terms. I loop thru the expenses table looking for a matching search term
My code is failing on items that have double quotes inside the value ie...Gillette "Boston" Stadium


Do While st = 1

' store search value to be used in criteria
If Not IsNull(rsExpenses!Purpose) Then
strPurpose = rsExpenses!Purpose
End If

' ensure we are at the beginning of the table
rsSearchTerms.MoveFirst
rsSearchTerms.FindFirst "Term Like """ & strPurpose & "*"""

If rsSearchTerms.NoMatch = False Then
' I want to write that record to a table for reporting
Endif

RE: Findfirst fails because data item has double quotes inside quotes.....

CODE

Private Sub Command16_Click()
  Dim rs As DAO.Recordset
  Set rs = Me.Recordset
  Dim str As String
  str = Me.Text14
  str = Replace(str, """", """""")
  str = Replace(str, "'", "''")
  rs.FindFirst "txtFld = '" & str & "'"
End Sub 

I have in my table
Smith
"Smith"
'Smith'

finds all of them

RE: Findfirst fails because data item has double quotes inside quotes.....

(OP)
thANKS , WILL TRY IN THE MORNING

RE: Findfirst fails because data item has double quotes inside quotes.....

(OP)
Brilliant... Worked great thank you

RE: Findfirst fails because data item has double quotes inside quotes.....

Pack10,
One or more of these guys deserves a star.

Duane
Hook'D on Access
MS Access MVP

RE: Findfirst fails because data item has double quotes inside quotes.....

(OP)
Hi

I did it from my phone last night and just checked it. It didnt save. So I re-entered it.
This site is the best, and I will again send a small token of my appreciation.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close