Results 1 to 4 of 4
  1. #1
    mojers is offline Novice
    Windows XP Access 2007
    Join Date
    Apr 2010
    Posts
    2

    Queries that Check field formats

    Hello there AccessForums people,

    I am not quite a newbie, have used Access a lot but mostly self tought so possible not the best!
    Anyway, I am stuck on a query and need some help!

    I need to be able to query (or perhaps macro) a code set used in my database, so I can capute human error in the typing of the codes.

    The code format (per record) is = RRCCCABC.C.001


    so 2 character combo, followed by a 3 character combo, followed by another 3 character combo, followed by a ".C.001".

    I want to make sure that we have 8 characters, followed by a ".C.001"
    I am not fussed at the moment what the characters are, just that they are 8 followed by the other bits.

    can anyone advice how I can create a query that will check for the field length of characters?

    thanks very much in advance!
    Mojers

  2. #2
    maximus's Avatar
    maximus is offline Expert
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Aug 2009
    Location
    India
    Posts
    931
    I have prepared a calculative Field in the query with the following conditions:
    Text is the Field with the Code Format

    CheckEntry: IIf(IsNull([Text]),"Blank",IIf(Len([Text])<>14,"Wrong_Entry",IIf(Right([Text],6)<>".C.001","Wrong Entry","Right_Entry")))

    1) if the Text field is Blank. Blank will be displayed
    2) if the Total length is <> 14 Wrong_Entry will be displayed.
    3) if the last 6 Characters are <> .C.001 then Wrong_Entry will be displayed.

  3. #3
    maximus's Avatar
    maximus is offline Expert
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Aug 2009
    Location
    India
    Posts
    931
    is you problem solved if yes mark the thread solved.

  4. #4
    mojers is offline Novice
    Windows XP Access 2007
    Join Date
    Apr 2010
    Posts
    2
    hey there maximus,

    This is perfect! thanks so much for your help!

    Mojers

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

Similar Threads

  1. Check Box Values in Queries
    By Rubz in forum Queries
    Replies: 3
    Last Post: 04-16-2010, 11:26 AM
  2. Changing field names in queries
    By scottsoo9 in forum Queries
    Replies: 1
    Last Post: 12-01-2009, 05:47 PM
  3. Replies: 1
    Last Post: 06-01-2009, 04:05 PM
  4. Replies: 0
    Last Post: 01-08-2009, 05:49 PM
  5. Automatic field check and population
    By danidin in forum Forms
    Replies: 0
    Last Post: 01-03-2009, 12:45 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