Input mask, Validation rule, search form

  • Thread starter Thread starter mhancoc
  • Start date Start date
M

mhancoc

Guest
I have a form that acts as a filter/search engine -- it inputs criteria into a query, then opens a report based on the criteria/query. One of the criteria options is "Supplier Number", which is to be entered into an unbound text box.

All of our suppliers have 10 digits, usually in this format: A123400000 (i.e. First character is either a Letter or digit, followed by four or five digits, then followed by four or five zeros)

Our system works with ten digit numbers, while the people in the dept are used to just typing in "A1234" assuming the zeros are irrelevant.

How do I create a validation rule or input mask where a user can simply type "A1234", then it will return zeros for the remaining of the ten required characters?

I realize the usual response to these type of simple question is "Search the Threads", but I have done so already and still don't have an answer!
 
On the before update for the text box, check the length of the string and if it is less than 10, simply add the appropriate number of zeros at the end...

Would this work?
 
Place this in the Input Mask field of the text box. It will "force" the user to key ten digits/characters.

AAAAAAAAAA;;#
 
KenHigg I'm sorry I forgot to clarify that I am still learning access, since I have never done this particular action, I'm not sure how to actually write the event procedure that you're trying to explain. Thanks for the help though, I'll anxiously await your reply!

ghudson, I had figured that out, but I was wondering if there was a way where it would just add the zeros itself so it won't confuse my coworkers. My temporary solution is AAAAAAAAA;;0, and if you only type in A1234, there are zeros still at the end, but it requires that you type 0s over the already existing 0's...stupid. PS are you from hudson ohio?
 
Hum... There may be a better way to do this but here goes -

In the before update event for the control box do something like:

Code:
dim intC as integer
dim strX as string
dim intX as integer

intC = 0
strX = me!myTextBoxName
intX = len(strX)

for intC = 1 to intX
strX = strX + "0"
next intC

me!myTextBoxName = strX


???
 

Users who are viewing this thread

Back
Top Bottom