Results 1 to 4 of 4
  1. #1
    2 Star Lounger
    Join Date
    Nov 2004
    Location
    Lexington Park, Maryland, USA
    Posts
    119
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Detecting incorrect format for text box entry (Access 2000)

    I have a problem with people entering values into a text box not in the standard format. I need everybody to enter the aircraft name "F-18" in that format, not "f-18" or "F18" or "F_18" or "F 18". What I would like to happen is for a button to be pushed and a msgbox would be displayed if the Aircraft Name is not in the correct format. Thanks for any help.

    Mike

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Detecting incorrect format for text box entry (Access 2000)

    If the entry has to be of the form upper case letter - hyphen - two digits, you can set the Input Mask property of the text box to

    <code>>L-00;0;_</code>

    > means convert all text to upper case
    L means one letter, required
    - means a hyphen as literal text
    00 means two digits, required

    0 means include the literal characters in the stored value

    _ is the placeholder character.

  3. #3
    2 Star Lounger
    Join Date
    Nov 2004
    Location
    Lexington Park, Maryland, USA
    Posts
    119
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Detecting incorrect format for text box entry (Access 2000)

    Thanks. That almost works. I can force it to work unless you can help me with the following. There are really 2 acceptable formats for entering the aircraft name. the "F-18" is actually "F/A-18". What I really need is to have the following 2 formats be acceptable: "F/A-18" and "F-14".

    Thanks
    Mike

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Detecting incorrect format for text box entry (Access 2000)

    It would have been useful if you had stated that in the original question. Input masks in Access do not provide for multiple patterns, so you can't use them for this situation. You need to write code in the Before Update event of the text box instead, and check the value entered character by character.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •