Solved

Using ' & " in Findfirst

Posted on 1998-09-05
2
232 Views
Last Modified: 2010-04-30
As this two characters (' and ") are reserved for string blocking in SQL statement, error occour if my searching string contains these two characters using Findfirst method.

Any ideas to solve it, when my string contains these two characters? Of course, the record should be found correctly.
0
Comment
Question by:HenryChan
2 Comments
 
LVL 2

Accepted Solution

by:
dabellei earned 60 total points
ID: 1433222
Here's the function i'm using for the ' character it can be use for the " character either.  You just have to double your '  so if you have like o'donnell in your query your query should look like  o''donnell, that's al.

Function apostrophe(texte As String)
      temp_texte$ = texte$
      lo = Len(temp_texte$)
      x = 0
      Do While x < lo
         x = x + 1
         If Mid$(temp_texte$, x, 1) = "'" Then
             temp_texte$ = Mid$(temp_texte$, 1, x) + Mid$(temp_texte$, x)
             lo = lo + 1
             x = x + 1
         End If
      Loop
      apostrophe = temp_texte$
End Function

0
 

Author Comment

by:HenryChan
ID: 1433223
Thanks. It do work !

Henry
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Use closed file on desktop in vba 6 65
add text to end of existing text in file 16 69
Convert VB6 MSXML2.ServerXMLHTTP process to C# 2 40
using web browser with BING 40 110
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

914 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now