Results 1 to 7 of 7
  1. #1
    Susy is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Sep 2014
    Posts
    134

    how to check before update after specific format for input field

    Hi guys,

    is it possible to check for input format before leaving field..

    The input field should follow this format:
    AR17XX9999

    where:
    AR stands for Area Report
    17 is for the year: 2017, 2018, 2019, 2020...
    XX two letters for the geographical area... 01, 08, 12, ...


    9999 for number for a maximum of 9999 reports over a year

    I will really appreciate if you could help me with this...

    Best regards!

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917
    Sure. Can you use code like Left(), Mid(), etc.?

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Are you using InputMask property?

    Or have users input parts into separate textboxes and use code to concatenate.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  4. #4
    Susy is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Sep 2014
    Posts
    134
    Hi guys,

    I totally forgot about left, right mid...and even len... so, I create an afterupdate event with msgboxes telling exactly where the error is...

    Thanks a lot again.

  5. #5
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917
    Use the BeforeUpdate event and set Cancel = True if it does not validate. It will hold the cursor in the same field unless you let it by.

  6. #6
    Susy is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Sep 2014
    Posts
    134
    Thanks... Set Cancel = True? Ok, will try then.

  7. #7
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,917
    Great! For the record, Cancel = True. No Set involved.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Check form field edit before update
    By mickelb in forum Programming
    Replies: 4
    Last Post: 09-16-2015, 07:51 AM
  2. Charts update based on input field
    By kentck86 in forum Forms
    Replies: 6
    Last Post: 06-09-2015, 09:19 AM
  3. Replies: 11
    Last Post: 06-02-2011, 10:21 AM
  4. check the format of an numeric inputted field?
    By eliotchs in forum Programming
    Replies: 1
    Last Post: 04-20-2011, 11:35 AM
  5. update field with specific content
    By luxeon in forum Queries
    Replies: 2
    Last Post: 01-24-2011, 03:29 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums