dbTalk Databases Forums  

Input Mask Problem !

comp.databases.ms-access comp.databases.ms-access


Discuss Input Mask Problem ! in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Prakash
 
Posts: n/a

Default Input Mask Problem ! - 05-18-2010 , 06:06 AM






I want to restrict a user to enter ONLY numbers 0-9 in a text box with
a max length of 10 digits. No signs, spaces allowed. All 10 digits are
not compulsory ... the user may enter just 8 digits also.

In another text box I want the user to enter a max number of 3
characters (letters) A-Z ONLY. No special characters allowed. All 3
letters are not compulsory ... the user may enter just 1 or 2 letters
only.

Could someone please help with this ?

Thx.
Prakash.

Reply With Quote
  #2  
Old   
Salad
 
Posts: n/a

Default Re: Input Mask Problem ! - 05-18-2010 , 10:06 AM






Prakash wrote:
Quote:
I want to restrict a user to enter ONLY numbers 0-9 in a text box with
a max length of 10 digits. No signs, spaces allowed. All 10 digits are
not compulsory ... the user may enter just 8 digits also.

In another text box I want the user to enter a max number of 3
characters (letters) A-Z ONLY. No special characters allowed. All 3
letters are not compulsory ... the user may enter just 1 or 2 letters
only.

Could someone please help with this ?

Thx.
Prakash.

??? 'alpha uppper case
9999999999 'digits only

Reply With Quote
  #3  
Old   
Prakash
 
Posts: n/a

Default Re: Input Mask Problem ! - 05-19-2010 , 08:18 AM



On May 18, 6:06*pm, Salad <sa... (AT) oilandvinegar (DOT) com> wrote:
Quote:
Prakash wrote:
I want to restrict a user to enter ONLY numbers 0-9 in a text box with
a max length of 10 digits. No signs, spaces allowed. All 10 digits are
not compulsory ... the user may enter just 8 digits also.

In another text box I want the user to enter a max number of 3
characters (letters) A-Z ONLY. No special characters allowed. All 3
letters are not compulsory ... the user may enter just 1 or 2 letters
only.

Could someone please help with this ?

Thx.
Prakash.

*>??? *'alpha uppper case
9999999999 *'digits only
Thx Salad ... but both allow "spaces" to be typed in (especially
9999999999). Any way of circumventing this ?

Rgds
Prakash.

Reply With Quote
  #4  
Old   
Salad
 
Posts: n/a

Default Re: Input Mask Problem ! - 05-19-2010 , 09:13 AM



Prakash wrote:

Quote:
On May 18, 6:06 pm, Salad <sa... (AT) oilandvinegar (DOT) com> wrote:

Prakash wrote:

I want to restrict a user to enter ONLY numbers 0-9 in a text box with
a max length of 10 digits. No signs, spaces allowed. All 10 digits are
not compulsory ... the user may enter just 8 digits also.

In another text box I want the user to enter a max number of 3
characters (letters) A-Z ONLY. No special characters allowed. All 3
letters are not compulsory ... the user may enter just 1 or 2 letters
only.

Could someone please help with this ?

Thx.
Prakash.

??? 'alpha uppper case
9999999999 'digits only


Thx Salad ... but both allow "spaces" to be typed in (especially
9999999999). Any way of circumventing this ?
Yes. Press Help (F1) on InputMask property. Switch 9 to 0.

Quote:
Rgds
Prakash.

Reply With Quote
  #5  
Old   
Prakash
 
Posts: n/a

Default Re: Input Mask Problem ! - 05-19-2010 , 12:14 PM



On May 19, 5:13*pm, Salad <sa... (AT) oilandvinegar (DOT) com> wrote:
Quote:
Prakash wrote:
On May 18, 6:06 pm, Salad <sa... (AT) oilandvinegar (DOT) com> wrote:

Prakash wrote:

I want to restrict a user to enter ONLY numbers 0-9 in a text box with
a max length of 10 digits. No signs, spaces allowed. All 10 digits are
not compulsory ... the user may enter just 8 digits also.

In another text box I want the user to enter a max number of 3
characters (letters) A-Z ONLY. No special characters allowed. All 3
letters are not compulsory ... the user may enter just 1 or 2 letters
only.

Could someone please help with this ?

Thx.
Prakash.

??? *'alpha uppper case
9999999999 *'digits only

Thx Salad ... but both allow "spaces" to be typed in (especially
9999999999). Any way of circumventing this ?

Yes. *Press Help (F1) on InputMask property. *Switch 9 to 0.



Rgds
Prakash.
Thx a ton Salad for your responses. I did try the F1 & searching
online too. And yes, I did try the inputmask "0000000000". The problem
here is that the user has to enter all 10 numeric characters. What if
the user wants to enter just 7 or 8 chars ?

I once again repeat ...
I want to restrict a user to enter ONLY numbers 0-9 in a text box
with
a max length of 10 digits. No signs or spaces to be allowed. All 10
digits are
not compulsory ... the user may enter just 8 digits also.

Thx again & Rgds,
Prakash.

Reply With Quote
  #6  
Old   
Salad
 
Posts: n/a

Default Re: Input Mask Problem ! - 05-19-2010 , 04:38 PM



Prakash wrote:

Quote:
On May 19, 5:13 pm, Salad <sa... (AT) oilandvinegar (DOT) com> wrote:

Prakash wrote:

On May 18, 6:06 pm, Salad <sa... (AT) oilandvinegar (DOT) com> wrote:

Prakash wrote:

I want to restrict a user to enter ONLY numbers 0-9 in a text box with
a max length of 10 digits. No signs, spaces allowed. All 10 digits are
not compulsory ... the user may enter just 8 digits also.

In another text box I want the user to enter a max number of 3
characters (letters) A-Z ONLY. No special characters allowed. All 3
letters are not compulsory ... the user may enter just 1 or 2 letters
only.

Could someone please help with this ?

Thx.
Prakash.

??? 'alpha uppper case

9999999999 'digits only

Thx Salad ... but both allow "spaces" to be typed in (especially
9999999999). Any way of circumventing this ?

Yes. Press Help (F1) on InputMask property. Switch 9 to 0.




Rgds
Prakash.


Thx a ton Salad for your responses. I did try the F1 & searching
online too. And yes, I did try the inputmask "0000000000". The problem
here is that the user has to enter all 10 numeric characters. What if
the user wants to enter just 7 or 8 chars ?

I once again repeat ...
I want to restrict a user to enter ONLY numbers 0-9 in a text box
with
a max length of 10 digits. No signs or spaces to be allowed. All 10
digits are
not compulsory ... the user may enter just 8 digits also.

Thx again & Rgds,
Prakash.
Don't know. You could use the 9 or #. Maybe have some event code to
remove spaces. Ex:
? replace("12 34 56"," ","")
123456

Reply With Quote
  #7  
Old   
James A. Fortune
 
Posts: n/a

Default Re: Input Mask Problem ! - 05-31-2010 , 12:25 AM



On May 18, 6:06*am, Prakash <sim... (AT) omantel (DOT) net.om> wrote:
Quote:
I want to restrict a user to enter ONLY numbers 0-9 in a text box with
a max length of 10 digits. No signs, spaces allowed. All 10 digits are
not compulsory ... the user may enter just 8 digits also.

In another text box I want the user to enter a max number of 3
characters (letters) A-Z ONLY. No special characters allowed. All 3
letters are not compulsory ... the user may enter just 1 or 2 letters
only.

Could someone please help with this ?

Thx.
Prakash.
Try the following:

'begin module code
Public Function LimitFieldToNDigits(KeyAscii As Integer, txtBox As
TextBox, intMax As Integer) As Integer
'If the field has reached its maximum then return 0
LimitFieldToNDigits = KeyAscii
'Always allow backspace
If KeyAscii = 8 Then Exit Function
txtBox.SetFocus
If Len(txtBox.Text) = intMax Then
LimitFieldToNDigits = 0
Exit Function
End If
'Only allow digits
If KeyAscii < 48 Or KeyAscii > 57 Then
LimitFieldToNDigits = 0
End If
End Function
'end module code

Example:

'begin code behind form
Private Sub txtDigitsOnly_KeyPress(KeyAscii As Integer)
KeyAscii = LimitFieldToNDigits(KeyAscii, txtDigitsOnly, 10)
End Sub
'end code behind form

Note: It will not prevent someone from pasting nondigits into the
textbox. Perhaps the BeforeUpdate (for bound) or AfterUpdate (for
unbound) events can be used to complete validation without getting
bogged down in such details.

James A. Fortune
MPAPoster (AT) FortuneJames (DOT) com

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.