473,320 Members | 1,825 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

form field validation

I'm sure this is very easy, but I know very little about access. I'm
trying to add a validation rule to my textbox to only accept
alphnumeric chars. From the alpha side, I tried Like "[a-z]" , which
accepts a single char. So I tried to add an asterisk ie. Like
"[a-z]*", but that now accepts any char. How do you apply the rule to
each character entered, if you don't know the length of the input
string beforehand? Thanks in advance.
Nov 12 '05 #1
1 1456
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

You could use the KeyDown event which fires each time a key is hit in
the control. Something like this:

Private Sub txtBox_KeyDown(KeyCode As Integer, Shift As Integer)

If (Keycode >= vbKey0 and vbKey9 <= KeyCode)
OR (Keycode >= vbKeyA and vbKeyZ <= KeyCode) Then
' Do Nothing
Else
' Not one of the permissible keys
KeyCode = 0
Beep ' Yell at the user
End If

End Sub

MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBP9/Is4echKqOuFEgEQJNyQCbBwXHtmpLY4j8eS+2PkWS9Qghr2IAo LXp
I+0Uy0wmmLQgE/CsQwsr7d5Y
=4zso
-----END PGP SIGNATURE-----

Barnoit wrote:
I'm sure this is very easy, but I know very little about access. I'm
trying to add a validation rule to my textbox to only accept
alphnumeric chars. From the alpha side, I tried Like "[a-z]" , which
accepts a single char. So I tried to add an asterisk ie. Like
"[a-z]*", but that now accepts any char. How do you apply the rule to
each character entered, if you don't know the length of the input
string beforehand? Thanks in advance.


Nov 12 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
by: Stefan Richter | last post by:
Hi, after coding for days on stupid form validations - Like: strings (min / max length), numbers(min / max value), money(min / max value), postcodes(min / max value), telefon numbers, email...
6
by: Charles Banas | last post by:
weird subject - i hope more than just one curious regular will hear me out. :) ok, i've got a bit of a big problem, and i need answers as soon as possible. i know this forum is meant for web...
5
by: billa | last post by:
I wish to carry out standard form validation (i.e. is it a date?, is there a value in the field, is it a number) using the onBlur event rather than the onSubmit event. This (of course) leads to...
16
by: Hosh | last post by:
I have a form on a webpage and want to use JavaScript validation for the form fields. I have searched the web for form validation scripts and have come up with scripts that only validate...
9
by: julie.siebel | last post by:
Hello all! As embarrassing as it is to admit this, I've been designing db driven websites using javascript and vbscript for about 6-7 years now, and I am *horrible* at form validation. To be...
11
by: Rik | last post by:
Hello guys, now that I'm that I'm working on my first major 'open' forms (with uncontrolled users I mean, not a secure backend-interface), I'd like to add a lot of possibilities to check wether...
10
by: gweasel | last post by:
What is the best way to apply a Validation Rule - or rather, where is the best place to put it? Is there an advantage to putting it on the field in the table vs setting the validation rule on the...
5
by: lucyh3h | last post by:
Hi, I am trying to use XMLHttpRequest to do server side validation. I have several fields on a form and a submit button. The submit button has an event assocated with it when clicked. The...
7
ak1dnar
by: ak1dnar | last post by:
Hi, I got this scripts from this URL There is Error when i submit the form. Line: 54 Error: 'document.getElementbyID(....)' is null or not an object What is this error. Complete Files
8
by: M.L. | last post by:
Hello. I created a form using JS validation with the form tag as follows: <form name="form1" action="dynaform.php" method="post" onsubmit="return pvg_sub();"> The js validation script sends...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.