![]() |
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 |
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 |
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 |
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. |
Textbox Validation
I don't understand if you must do this for each character typed or you must
do this for more text box? |
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. . |
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. . |
All times are GMT +1. The time now is 10:22 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com