If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Delphi, C etc > Validate

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-18-03, 19:05
bbk bbk is offline
Registered User
 
Join Date: Feb 2003
Location: Ontario, Canada
Posts: 19
Validate

Hi

I'm trying to validate a name field so that it allows and letter, -, ` and ' but I'm not sure how to allow the user to enter a single quote. Does anyone have any suggestions?

This is what I've got so far:

For i = 1 To Len(name1)
If (Mid$(name1, i, 1) Like "[A-Za-z-' ]") Then
Invalid = False
End If

Next i

I would appreciate any help anyone has to offer.

Thanks in advance.
Reply With Quote
  #2 (permalink)  
Old 11-18-03, 22:25
rnealejr rnealejr is offline
Registered User
 
Join Date: Feb 2002
Posts: 2,232
Is this a text box that a user will be entering characters (and you want to validate what they enter) ?
Reply With Quote
  #3 (permalink)  
Old 11-18-03, 23:58
khurramanis khurramanis is offline
Registered User
 
Join Date: Nov 2003
Location: Lahore, Pakistan
Posts: 5
Re: Validate

replace all one single quote ' with '' two single quotes
name1 = replace(name1,"'","''")

Khurram
Reply With Quote
  #4 (permalink)  
Old 11-19-03, 00:10
rnealejr rnealejr is offline
Registered User
 
Join Date: Feb 2002
Posts: 2,232
Quote:
replace all one single quote ' with '' two single quotes
name1 = replace(name1,"'","''")
This will help when inserting into a database - but I think he wants to validate the textbox itself based on a particular range of characters.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On