From: leerem on
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

From: SteAXA on
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
>
From: leerem on
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
> >
From: Helmut Meukel on
"leerem" <leerem(a)discussions.microsoft.com> schrieb im Newsbeitrag
news:28E52688-81C4-4C61-B966-123C766B054D(a)microsoft.com...
> 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.



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