Results 1 to 5 of 5
  1. #1
    Osiris is offline Novice
    Windows Vista Access 2007
    Join Date
    Jun 2011
    Posts
    3

    Autonumber Prefixes into a Query

    Hello Everyone,

    My issue is that I have three tables each with the field QuoteID. Each of quoteid field has its own autonumber prefix aka "AT" 0001, "BT"0001, and "CT"0001. I have successfully created a union query linking all of these tables together based on a different criteria. My problem is that in the union query the prefixes I had given to quoteid number is not showing up and I am left with 3 entries of 0001 instead of like it is above. Any help would be great.



    Thanks,
    Osiris

  2. #2
    Rod is offline Expert
    Windows Vista Access 2007
    Join Date
    Jun 2011
    Location
    Metro Manila, Philippines
    Posts
    679
    Hopefully you have three parts to your union query, one part for each table. If so include (I assume the term 'prefix' does not occur elsewhere)

    "AT" AS Prefix

    after the select on the first table

    "BT" AS Prefix

    after the select on the second table and so on.

    Make sure this phrase is in the same position for each part.

    You may also concatenate the QuoteId with the prefix if you so wish.

  3. #3
    Osiris is offline Novice
    Windows Vista Access 2007
    Join Date
    Jun 2011
    Posts
    3
    Thanks very much Rod for your help. That is what I thought was the right thing to do. I don't know if this changes anything but say if I have a SELECT * (all) for a table where do I put the AS Prefix?

    Osiris

  4. #4
    Rod is offline Expert
    Windows Vista Access 2007
    Join Date
    Jun 2011
    Location
    Metro Manila, Philippines
    Posts
    679
    Doesn't matter!

    SELECT "AT" AS Prefix, * FROM Table;

    or

    SELECT *, "AT" AS Prefix FROM Table;

    are both valid.

    If you want to concatenate at the same time then use:

    SELECT "AT" & QueryID AS ExtendedID FROM Table;

    Have fun.

  5. #5
    Osiris is offline Novice
    Windows Vista Access 2007
    Join Date
    Jun 2011
    Posts
    3
    Once again Rod, you are very helpful. Thanks for your advice.

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

Similar Threads

  1. Help with autonumber
    By GDubbs780 in forum Programming
    Replies: 15
    Last Post: 02-27-2011, 02:27 PM
  2. Query to Reset AutoNumber to 1 after full delete
    By saigovind in forum Queries
    Replies: 1
    Last Post: 02-04-2011, 03:43 AM
  3. Replies: 7
    Last Post: 01-06-2011, 12:34 PM
  4. Add prefix to AutoNumber
    By sirmilt in forum Database Design
    Replies: 3
    Last Post: 07-09-2010, 01:41 PM
  5. AUTONUMBER
    By J A F F A in forum Database Design
    Replies: 1
    Last Post: 10-03-2007, 10:30 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