Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 88
Default Textbox Validation

Hi,
I have a userform that users enter the Drivers Name of the vehicle
into, plus other data. User's being how they are, tend to enter other
meanings as well, I've managed to sort out the unwelcome messages and any
numerical entries, but how do i prevent an entry such as "pppppppppp",
"kkkkkkkkkk" or even something like "po po po po" as an example.

I've tried coding this but have had no luck. to be honest I'm a bit baffled
as to how to overcome this. Please help

Regards Lee

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default Textbox Validation

Hi, i solved a similar problem (i'd problem with data) like this:

Sub Test_Number()
Dim n As Integer

On Error GoTo InvalidValue
n = CDec(tbValori)

InvalidValue:
If Err.Number = 13 Then
MsgBox "Invalid data: it's must be a number!"
End If

End Sub

I wish to be helpful.

"leerem" wrote:

Hi,
I have a userform that users enter the Drivers Name of the vehicle
into, plus other data. User's being how they are, tend to enter other
meanings as well, I've managed to sort out the unwelcome messages and any
numerical entries, but how do i prevent an entry such as "pppppppppp",
"kkkkkkkkkk" or even something like "po po po po" as an example.

I've tried coding this but have had no luck. to be honest I'm a bit baffled
as to how to overcome this. Please help

Regards Lee

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 88
Default Textbox Validation

many thanks for replying, the solution that you applied is for isolating text
only. I need assistance with resolving repeated text, as in my previous
thread. Can you assist with this?


"SteAXA" wrote:

Hi, i solved a similar problem (i'd problem with data) like this:

Sub Test_Number()
Dim n As Integer

On Error GoTo InvalidValue
n = CDec(tbValori)

InvalidValue:
If Err.Number = 13 Then
MsgBox "Invalid data: it's must be a number!"
End If

End Sub

I wish to be helpful.

"leerem" wrote:

Hi,
I have a userform that users enter the Drivers Name of the vehicle
into, plus other data. User's being how they are, tend to enter other
meanings as well, I've managed to sort out the unwelcome messages and any
numerical entries, but how do i prevent an entry such as "pppppppppp",
"kkkkkkkkkk" or even something like "po po po po" as an example.

I've tried coding this but have had no luck. to be honest I'm a bit baffled
as to how to overcome this. Please help

Regards Lee

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default Textbox Validation

I don't understand if you must do this for each character typed or you must
do this for more text box?

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default Textbox Validation

"leerem" schrieb im Newsbeitrag
...
Hi,
I have a userform that users enter the Drivers Name of the vehicle
into, plus other data. User's being how they are, tend to enter other
meanings as well, I've managed to sort out the unwelcome messages and any
numerical entries, but how do i prevent an entry such as "pppppppppp",
"kkkkkkkkkk" or even something like "po po po po" as an example.

I've tried coding this but have had no luck. to be honest I'm a bit baffled
as to how to overcome this. Please help

Regards Lee



I don't think you can rule out all bogus entries. You can try, but...
Out of the top of my head: use Mid(entry$, p, 1) in a for next loop like

Function IsBogus(entry as string)
dim ch as string
for p = 1 to len(entry) - 2
ch = mid(entry, p, 1)
if mid(entry, p, 3) = String(3, ch) then
IsBogus = true
exit function
endif
next p
...
End Function

How to deal with names like
Donald Duck,
Mickey Mouse,
Jane Doe,

you can make a list to check against, but..

Helmut.





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 88
Default Textbox Validation

Great, that's the type of code that should do it! I'll add it in and let you
know.....
Many thanks

Lee


"Helmut Meukel" wrote:

"leerem" schrieb im Newsbeitrag
...
Hi,
I have a userform that users enter the Drivers Name of the vehicle
into, plus other data. User's being how they are, tend to enter other
meanings as well, I've managed to sort out the unwelcome messages and any
numerical entries, but how do i prevent an entry such as "pppppppppp",
"kkkkkkkkkk" or even something like "po po po po" as an example.

I've tried coding this but have had no luck. to be honest I'm a bit baffled
as to how to overcome this. Please help

Regards Lee



I don't think you can rule out all bogus entries. You can try, but...
Out of the top of my head: use Mid(entry$, p, 1) in a for next loop like

Function IsBogus(entry as string)
dim ch as string
for p = 1 to len(entry) - 2
ch = mid(entry, p, 1)
if mid(entry, p, 3) = String(3, ch) then
IsBogus = true
exit function
endif
next p
...
End Function

How to deal with names like
Donald Duck,
Mickey Mouse,
Jane Doe,

you can make a list to check against, but..

Helmut.



.

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default Textbox Validation

To catch things like "po po po po" you could use a similar approach,
step with mid(entry, p, 3) through the string and compare with mid(entry, p+3,
3)
For entries like "sdfghjkl" you can check for consecutive consonants, step
through the string with mid(entry, p, 1) and count the consonants, reset the
counter every time it's a vowel or a space. If counter is 4 (or 5) then it's
bogus.
To allow for some eastern european names 5 might be better.

Helmut.


"leerem" schrieb im Newsbeitrag
...
Great, that's the type of code that should do it! I'll add it in and let you
know.....
Many thanks

Lee


"Helmut Meukel" wrote:

"leerem" schrieb im Newsbeitrag
...
Hi,
I have a userform that users enter the Drivers Name of the vehicle
into, plus other data. User's being how they are, tend to enter other
meanings as well, I've managed to sort out the unwelcome messages and any
numerical entries, but how do i prevent an entry such as "pppppppppp",
"kkkkkkkkkk" or even something like "po po po po" as an example.

I've tried coding this but have had no luck. to be honest I'm a bit baffled
as to how to overcome this. Please help

Regards Lee



I don't think you can rule out all bogus entries. You can try, but...
Out of the top of my head: use Mid(entry$, p, 1) in a for next loop like

Function IsBogus(entry as string)
dim ch as string
for p = 1 to len(entry) - 2
ch = mid(entry, p, 1)
if mid(entry, p, 3) = String(3, ch) then
IsBogus = true
exit function
endif
next p
...
End Function

How to deal with names like
Donald Duck,
Mickey Mouse,
Jane Doe,

you can make a list to check against, but..

Helmut.



.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Textbox validation TUNGANA KURMA RAJU Excel Discussion (Misc queries) 5 May 8th 09 11:15 PM
Textbox validation [email protected] Excel Programming 9 May 29th 08 09:59 AM
textbox validation TC[_6_] Excel Programming 2 October 13th 04 03:19 AM
Textbox validation phreud[_17_] Excel Programming 6 June 27th 04 07:49 PM
textbox validation Beginner[_2_] Excel Programming 1 April 7th 04 07:46 PM


All times are GMT +1. The time now is 12:28 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"