Solved

Embedded Quotes

Posted on 2001-08-07
6
273 Views
Last Modified: 2010-05-02
What is the best way to get rid of embedded quotes as in
Chain 3.75" Pitch 3/8" Diameter.
I just want to eliminate the " or CHR(34) and leave nothing.
I import several thousand rows and 15-20 have embedded quotes in them. I want a function to clean these out.

Thanks
Paul
0
Comment
Question by:PaulCr125
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 8

Expert Comment

by:Dave_Greene
ID: 6361139
StrResult = Replace(StringIN, Char(34), "")
0
 

Author Comment

by:PaulCr125
ID: 6361285
Dave
I'm Access 97 no replace function.
But I do have VB6 and when I run
Replace("Chain 3.75" Pitch 3/8" Diameter",Chr(34),"")
... I get an expected list seperator or ) error

I appreciate your help
0
 
LVL 8

Accepted Solution

by:
Dave_Greene earned 50 total points
ID: 6361335
You need to put the text in a variable...  the function doesn't know how to react to the text you have entered

Try this

StringX = Chr(34) & "Chain 3.75" & Chr(34) & " Pitch 3/8" & Chr(34) & " Diameter" & Chr(34)

Then

Replace(StringX, Chr(34), "")


0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 22

Expert Comment

by:rspahitz
ID: 6361438
Dave's right--you can't embed a quoted string into VB as though it's coming from a database and assume the syntax is correct!

My only recommendation, for clarity, is to replace the "constants":

Const DoubleQuote as string = """" ' chr$(34)

OriginalString = "Chain 3.75" & DoubleQuote & " Pitch 3/8" & DoubleQuote & " Diameter '---> Chain 3.75" Pitch 3/8" Diameter

NewString = Replace(OriginalString, DoubleQuote, vbNullString)

Also, if you want to do this in Access97, use the same code, but create your own replace function:

Function Replace(OriginalString, SearchString, ReplaceString) as String
  ' Note that this will not work if ReplaceString is a substring of SearchString

  dim strTemp as string
  dim iFoundPosit as integer

  strTemp = OriginalString

  do
    iFoundPosit = instr(strTemp, SearchString)
    if iFoundPosit = 0 then exit do
    strTemp = left$(strTemp, iFoundPosit-1) _
            & ReplaceString _
            & mid$(strTemp, iFoundPosit+len(SearchString)+1)
  loop

  Replace = strTemp
end Function
0
 

Author Comment

by:PaulCr125
ID: 6361482
Thanks Dave,
   I guess this errant embedded quote is a bigger problem than I thought.
I am parsing a database so I'm out of luck to do it in a function?

Paul
0
 

Author Comment

by:PaulCr125
ID: 6361577
Thanks Dave,
   I guess this errant embedded quote is a bigger problem than I thought.
I am parsing a database so I'm out of luck to do it in a function?

Paul
0

Featured Post

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question