auto-modify user form input (1 Viewer)

troncarver

Registered User.
Local time
Today, 05:34
Joined
Jan 31, 2006
Messages
14
I have a form where a user will enter a 11 digit number (12345043456). Using ASP (VB) this string of numbers queries an access database and returns the entry for that specific number to the user.

Unfortunately, the numbers in the access table are an 11 digit number with hyphens seperating the string like this 12345-04-3456 (the ndc # of a pharmaceutical).

So What i need is some code that monitors and modifies the form input so that the hyphens are added in to the string when the user is inputting the data.

If i cannot do this, then is there some VB that I can add which modifies the field in the text file when it is imported into access on a daily basis.


Thanks
Terrons
 

ghudson

Registered User.
Local time
Today, 08:34
Joined
Jun 8, 2002
Messages
6,195
I dislike the use of Input Masks but you situation might benefit from one.

Put this in the Input Mask property of your text box...

00000\-00\-0000;0;_
 

supercharge

Registered User.
Local time
Today, 05:34
Joined
Jun 10, 2005
Messages
215
Ghuson,

Isn't it true that Input Mask forces users to input as set-format?

I think what he wants is that the input gets modified (dashes added after the input box is updated) afterwards. That case, the user just has to enter numbers w/o dashes and then when the number is stored into a table, it gets modified beforehand.
 

ghudson

Registered User.
Local time
Today, 08:34
Joined
Jun 8, 2002
Messages
6,195
Based on his "So What i need is some code that monitors and modifies the form input so that the hyphens are added in to the string when the user is inputting the data." statement I thought it would be best to force the user to key the numbers and the input mask will force the correct format with the hyphens. The hyphens will be stored with the text value because the settings in the input mask I created above.

Addding the hyphens after the text is keyed could be done but it would be a lot of work and there would be more work involved with testing the data to ensure the user keyed in the right amount of numbers with each section of hyphens.

As usual with Access, there are a lot of ways to get to the same answer.

Maybe Terrons will post back with more details or at least let us know if this works.
 

troncarver

Registered User.
Local time
Today, 05:34
Joined
Jan 31, 2006
Messages
14
thank you so far people

I am going to try that right now, but yes i think that i just want the string formatted before it is submitted. I want the user to type in the number without the hyphens and i want the hyphens to automatically insert themselves as the user is entering the input string.

Also, with this number, rather text string, I need to have the first digit dropped from the string when it is being imported into access. Someone gave me this code but i do not know how to implement it and do i have to change the variables to the field name, the field name is ndc so how would it look? Would i put this in a module and call it from a macro after or before the file is being imported? Right now i have a module that is called by a macro as soon as access opens that deletes the table and repopulates it with the new text file import:

Dim li_String as Integer

li_String = value

li_String = Right(li_String, 10)
 

ghudson

Registered User.
Local time
Today, 08:34
Joined
Jun 8, 2002
Messages
6,195
One thing at a time here. Will the input mask gave you do what you want?

Your second question qualifies as double posting for you already have a thread started with your other question. Keep things simple and we will all benefit.
 

supercharge

Registered User.
Local time
Today, 05:34
Joined
Jun 10, 2005
Messages
215
Sample attached -

See the attached sample, created just for you.

You can learn from there.

So long,
 

Attachments

  • Input.zip
    15.6 KB · Views: 143

ghudson

Registered User.
Local time
Today, 08:34
Joined
Jun 8, 2002
Messages
6,195
For this instance I still prefer forcing an input mask on the user.
 

Attachments

  • ForceHyphens.zip
    9 KB · Views: 135

jdraw

Super Moderator
Staff member
Local time
Today, 08:34
Joined
Jan 23, 2006
Messages
15,379
wizzina,
You have attached your post to a 14 yr old thread????
 

Users who are viewing this thread

Top Bottom