[AccessD] Handle quotes (') in strings

Jim Lawrence accessd at shaw.ca
Thu Dec 28 02:22:22 CST 2006


Hi Sad:

Here is a function that I standardly use in a number of my applications for
removing particular strings:

Public Function StripInvalidCharacter(ChkText As String, strInvalidCharacter
As String)
 Dim lbPosition As Integer
 Dim lbLength As Integer
    
 lbLength = Len(ChkText)
 lbPosition = InStr(1, ChkText, strInvalidCharacter)
    
 Do While lbPosition > 0 And lbPosition < lbLength
   ChkText = Left(ChkText, lbPosition - 1) & Mid(ChkText, lbPosition + 1)
        lbPosition = InStr(lbPosition + 2, ChkText, strInvalidCharacter)
 Loop
    
  StripInvalidCharacter = ChkText
    
End Function 

The previous code takes the string to be stripped and the string to be
removed and then returns a clean string. This routine works with any Access
versions. 

HTH
Jim  

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Sad Der
Sent: Wednesday, December 27, 2006 11:19 PM
To: Acces User Group
Subject: [AccessD] Handle quotes (') in strings

Hi group,

I need to insert several strings in a table.
These strings CAN contain quotes ('). Does anybody have a routine lying
around that handles these quotes?

e.g. I need to insert values like:
's-hertogenbosch

I need this urgently!!

TIA!!!

Sander


PS Sorry for being so blunt...



__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list