1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Hi Guest, welcome to the TES Community!

    Connect with like-minded professionals and have your say on the issues that matter to you.

    Don't forget to look at the how to guide.

    Dismiss Notice

Input Masks

Discussion in 'Computing and ICT' started by l0vaduck, Jan 9, 2011.

  1. Apologies if this has been answered before. I did a search and looked at loads of posts but apart from a hint, I didn't get the answer to my question.
    I have never actually needed to teach input masks in Access before (and they haven't worked on our network until recently anyway). Now they've put it on the AQA Business & Communication Systems spec so I'm teaching it to my year 11s.
    I thought I'd try it with postcodes, as they seem the obvious choice, but can't get it to work properly. The problem is that the number of letters and numbers in the first half of the postcode varies. You can have either one or two letters followed by either one or two numbers.
    I tried this: L?90 0LL but it only works if you then enter a space for the missing letter or number. Can anyone tell me how to do it so that it works for any valid UK postcode without having to put in spaces?
    I'm using Office 2003, if that makes any difference.
    If it's not possible to make it work with postcodes, what other simple example would you use to teach it to a mixed ability group of year 11s? I thought forms (ie registration groups) but that won't work either because of them having either 1 or 2 digits.
     
  2. Postcodes are a far from obvious choice, believe me.
    Capital letters on names and places are a nice simple start.
    Look in the Access built-in help for some good, simple examples and all of the available mask characters - plenty to get on with there.
    Unbelievably, some classes can sometimes really enjoy this topic.

     
  3. djphillips1408

    djphillips1408 New commenter

    I can't find the thread either that discussed this at length about 5 years ago. The problem was that you have the likes of E1 and WC1V in London for example. IIRC we ended up with something like &L0& 0LL as the best bet, but you can't avoid using the space key. One other issue thrown into the mix by fatmax is that there are 5 characters that can not be used as the last letter for a postcode too but I can't recall what they were, and I can't see how an input mask could rule out specific letters.
     
  4. It's not possible to use a simple input mask that will ensure absolutely every postcode is valid as there are several variations on valid UK postcodes:
    W1 3PD
    W1F 0AN
    WA13 9TR
    WA1 2PS
    WC2E 8JT
    About the closest input mask I can find is
    >LCCC\ 9LL
    but you will find you need to put extra spaces in the middle sometimes and it won't stop you putting in values like ABC1 1AB or A123 1AB.
    You need to write quite a complicated VBA validation routine if you want to check all the possibilities.
    It would be easier to teach setting input masks on something like a product code of the form LL000 or National Insurance Number >LL\ 00\ 00\ 00\ L
    www.allaboutitq.co

     
  5. In addition, the letters C, I, K, M, O or V can't be used in the second part of the postcode.
    www.allaboutitq.co
     
  6. Very full response (as usual), Andrea.
    Same answer as mine though!
    I've always found Post Codes are always the ones kids want to do but are for the advanced only.
    Like I said, there are plenty of examples in the Access help file which would more than suffice for the purposes of this spec.

     
  7. Thank you all - I think I will avoid postcodes then!
    I've printed a list of the codes from the Access help. Unfortunately this appears only to be available online. In the exam, students don't have access to online help. It seems unreasonable to expect them to learn this list by heart, specially as no reasonable person ever would in real life! I have posed the question to the AQA support bods in an attempt to find out just how much detail they expect us to cover.
     
  8. Hi,
    I just had a quick look and found all of the INPUT MASK characters in offline help along with the INPUT MASK syntax examples.
    The examples were a little more underwhelming than I remember but the Tel. no eg with brackets as literal characters seems useful.
     
  9. Thanks JB. I will have to experiment in school - I have a feeling we've drawn a blank with offline help before. Our network's a weird and wonderful thing!
     
  10. Sorry JB, I couldn't resist answering this one as postcodes are a particular pet topic of mine having written an Excel VBA screen scraper to harvest co-ordinates! I just thought I'd show some sample masks which I would use when teaching this as it's nice to start off with simple masks like the product code one and then progress to ones which set the position of spaces, etc. I'm just writing this section in my iTQ Level 3 Access resources at the moment.
    www.allaboutitq.co
     

Share This Page