Results 1 to 3 of 3
  1. #1
    batnose is offline Novice
    Windows Vista Access 2003
    Join Date
    Nov 2009
    Posts
    2

    Many Fields into one Field


    I need to make one big identifcation number called Cert# based on data in four fields in a table. Four fields are: Event, Year, Cat, DID

    First question - I need to say if Event = Live then enter L, if Event = Red then enter R, if Event = anything else then enter S

    Year is fine as it is an auto entry and always is 10, as in 2010.
    Cat is fine as it is a single digit

    Second question - DID is an auto number in the table. I need it to be three digits in the Cert#. I need to add some leading zeros if they are needed.

    An example of what the resulting Cert# should look like is L104001.

    I don't even know where to begin with this, if it should be in a query or what. If you have to use code, please be very specific because I don't even know where it would go. Any and all suggestions are appreciated.

    Thank you!

  2. #2
    dcrake's Avatar
    dcrake is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Aug 2009
    Posts
    435
    You can display this in a query using the following code

    Cert:IIF(Event="Live","L",IIF(Event="Red","R","S") & Year & Cat & Format(DID,"000")

    However you need to change the field name Year as this is an Access reserved word. I suspect the Event may be one too.

    David

  3. #3
    batnose is offline Novice
    Windows Vista Access 2003
    Join Date
    Nov 2009
    Posts
    2
    Thank you so much for your quick reply.

    An error message told me it's missing a parenthesis so it should read like this:
    Cert:IIF(Event="Live","L",IIF(Event="Red","R","S") ) & Year & Cat & Format(DID,"000")

    No biggie! This is fabulous. Thanks for the tip about changing the field names. I will have to learn more about these IIF statements now.

    Thanks, again!

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

Similar Threads

  1. Concatenating many fields into one field
    By olidav911 in forum Programming
    Replies: 1
    Last Post: 08-13-2009, 05:14 AM
  2. Replies: 3
    Last Post: 08-02-2009, 03:52 PM
  3. Splitting a field to separate fields
    By Petefured in forum Programming
    Replies: 8
    Last Post: 06-08-2009, 04:11 AM
  4. Replies: 1
    Last Post: 10-26-2007, 07:29 AM
  5. Concatenate two fields (text & number) for key field
    By Larry Elfenbein in forum Forms
    Replies: 2
    Last Post: 11-10-2005, 07:45 AM

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