how can i limit number of digits entered in the text box? please help!

maisam

Registered User.
Local time
Today, 05:55
Joined
Oct 25, 2005
Messages
15
Hi guys,

I have a text box, which requires a 8-digit number entry. I have wrote the code to check that the length is 8 and if it isn't a label will turn visible next to the field telling the user entry must be 8 digits.

This works for when i enter a number less than 8-digits but when i input a number with more digits as it does not fit into the text box it turns it to a scientific format value and when the code runs it shows the length is actually 8! And therefore the entry is valid!

I.e. when i input 123456789 the text box shows 1.23E+08 which is 8 charecters!

I dont want any error messages to pop up as i handle them by code and use labels to show the error message next to the problem field and i would like to keep this consistent. Is there any way i can do this by a function or a property in the table or form?

I appreciate any help/advice

cheers
 
Ok, here's a quick nasty way that works. Create a table with a single field in it called length. In the field properties change the size to 8. Link your form to the table and the text box to the length field. You should now only be able to enter 8 characters max into that text box. Let me know if this works, I’m sure there's a cleaner way of doing this but I need to look into it.:)
 
You could check for the length of the text in the textbox on each 'KeyUp' Event for that textbox. Then you could warn the user that they are entering too much data for that field. You would also have to reset the text in the textbox to the left 8 characters that were originally in there.
 

Users who are viewing this thread

Back
Top Bottom