?
Solved

Combine Text and Auto Number to create a unique ID

Posted on 2012-08-19
2
Medium Priority
?
1,437 Views
Last Modified: 2012-08-19
Experts:
I need to create a unique ID in a table when an access record is created on a form.  
I want to combine a text string with the auto number so that the default auto numbers from different data sources  would not result in a duplicate.  
The text string would be the first two characters from one field and some zeros combined with the auto number.  I would like to control the field length so that it would sort alpha numerically in the order that the records were created.
IE:  Combine the fields [Location] and [ID] so the result is  Lo000001:Lo000999,Lo001000... etc.
Thanks again!
AJP
0
Comment
Question by:AMixMaster
2 Comments
 
LVL 75

Accepted Solution

by:
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform) earned 2000 total points
ID: 38309867
I suggest instead you keep two separate fields, then create a Unique Index on the Auto Number and the Text String  ... this is much cleaner, and accomplishes the same thing.
0
 

Author Closing Comment

by:AMixMaster
ID: 38309908
The text string would have hundreds of duplicates.  
I use a default value for the text string ( [Location] )for each remote database location.  
The auto number would have 1 dup for each table created remotely.  
We want to combine unique records.  
When appending to the main database, in order to prevent duplicates the append query table join would be set up...
That is the point where I thought that I would require a unique ID field
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
The Relationships Diagram is a good way to get an overall view of what a database is keeping track of. It is also where relationships are defined. A relationship specifies how two tables connect to each other. As you build tables in Microsoft Ac…

571 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question