Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Data Input Restriction

Status
Not open for further replies.

Thorny

Programmer
Jul 2, 2001
23
GB
I have textbox that is going to capture account numbers of varying length based upon the Institution they belong to. If for example an account has 9 digits I would like the text box to stop accepting the user input once the 9 digits have been entered?
 

You really need to clarify your post a little bit! Do you have a separate textbox for account numbers for each kind of institutions, or do you have a single textbox for all types of institutions? If you'tr using a single textbox, how are you indicating the type of institution?

The Missinglinq

Richmond, Virginia

There's ALWAYS more than one way to skin a cat!
 
How are ya Thorny . . .

Your idea has an ugly side effect. If you lockout input when proper character count is reached, [blue]how would you correct typo's?[/blue] [surprise]

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
 
Apologies for being vague, I have a combo box with the institutions being selected prior to the account numbers being input, each instituion has its own account number format. Does this make it any clearer?
 
Thorny said:
[blue] . . . each instituion has its own [purple]account number format[/purple].[/blue]
The combobox rowsource needs to be based on a table that includes a field for the account format (say [blue]AcctFmt[/blue]). This makes the format easily available thru the combo (this column can be hidden).

Since your talking format (a bit more to check than just length), the [blue]AcctFmt[/blue] field could comprise indicators for validating.

As an example, using N for numbers, L for letters here's what [blue]AcctFmt[/blue] would like for the following account numbers:

[tt]Account Number 465-T2054A-01
AcctFmt NNN-LNNNNL-NN

Account Number CZ 020567NB744-05A
AcctFmt LL NNNNNNLLNNN-NNL

Account Number 4567089458990087744
AcctFmt NNNNNNNNNNNNNNNNNNN[/tt]

You'll have to get those formats in the field, but once your done [blue]you'll be able to validate length and format.[/blue]

Use the [blue]On KeyDown[/blue] event of the [blue]account number[/blue] textbox for a character by character validation and the ability to block keys.

[blue]Your Thoughts? . . .[/blue]


Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top