Full Version: Input Masks and Postal Codes
UtterAccess Forums > MicrosoftŪ Access > Access Forms
argeedblu
Input masks are particularly useful for ANA ANA postal code formats (such as Canadian Postal codes). In my current project most addresses are Canadian addresses but there will possible some non-canadian (specificaly U.S.) addresses where the postal code will be a different format (all numeric 5-4 format, for example.)
On the interests of normalization I want to have a single table (addresses) with a single postal code field. I would like to use an input mask on my data entry form so that it will modify the input mask or use an alternate control to capture the non ANA ANA postal code. The form is unbound and I will be using VBA to update the address data. I assume that the postal code (text) field in the address table will not have a problem with whatever format the data is in when I update the table.
The problem I am concerned with, however, is that I would like to use a mask on forms and reports that display a previously recorded postal code. How do I get the output object to recognize the appropriate format for each record and display it correctly?
Any thoughts or suggestions as to a workable strategy?
Glenn
Jack Cowley
Glenn -
The thought that sprang to mind (scary!) is that the US Zip codes are all digits (with a hyphen) but Canadian Postal codes contain letters as well as digits, right? If that is so then a postal code with no letters must use the US format and a postal code with letters must use the Canadian format. Would checking the characters in the postal code work for you or had you thought of that and discarded it?
Jack
argeedblu
That's a good thought, Jack.
guess if I use strictly unbound forms, things might work all right. What is sticking in my mind at the moment is that if I have a control with an ANA NAN mask on a bound form, the form won't know ahead of time which format applies to any given record. So if I am paging through addresses, what happens when the form encounters a US style (all numeric with hypen format) if the mask is expection the Canadian mixed Alpha Numeric style (T6B 2K9, for example.)
To give you a bit of context as to where I am coming from, I like to use a single form for both input and data display, locking or enabling controls when the form opens depending on why the form is being called. As I am writing and thinking about the problem I see, the strategy I am coming to consider is to store the fully formatted code in a text field and then use an unmasked control for display. If the form is opened for input, I would hide that control and display a masked control that is determined by the record's regional data.
I have seen web pages where the postal code control is determined by the users country indication. Seems to mean that the user must indicate country before being able to input the postal code and that goes against what I see as the logical flow of input. (I think in linear terms when it comes to addresses and Country is the end of the line to my way of thinking.)
For the particular db I am working on the Canadian/US postal code format will most likely be the only issue so detecting a non-numeric at the first character may be the way to go. However, I am aware of other international codes that have yet other fomats (gee, maybe ISO should have a look a the issue).
Glenn
Jack Cowley
Hmmm. If you are using unbound forms then your idea of saving the data formated may be the way to go. As for input you may have to put country before the postal code, though it goes against your preference, so that you know what format mask to use.
would mull on this a bit more, but unfortunately I have to head out for the day. If, due to the fact it is raining, I get back before 6pm I will post any ideas that should come to my fevered brain...
Good luck with this Glenn!
Jack
argeedblu
Thanks Jack,
would appreciate any other thoughts you may have, whenever you have a moment to post them. I will see what I can do to post my ultimate solution once the optimal solution comes to lilght.
Glenn
JimCagle
Howdy,
Looking through a list of Canadian Province Codes, there seem to be NO duplication between those and US State (and Territory) codes.
So you would be able to determine the mask for the ZIP based on the State / Province (whether Canadian or US style). And actually, you could determine the country also. But then wouldn't that be storing a "calculated" value?
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.