How do I Create a unique identifier from field value plus date

Posted on 2012-09-20
Last Modified: 2012-09-20
Hello experts and happy friday.

I'm hoping the following can be done relatively easily.

I have a field on a form called 'CallID' I want to populate the field with an identifier that is a combination of another field (UserID) and the date & Time that the event was recorded.

Can it be done?
What do you call the procedure?
How do Ido it?

Thanks for your help.

Question by:dj1710
    LVL 84

    Accepted Solution

    First: I'd suggest you NOT use this as your Primary Key value for the field, and in fact you probably shouldn't even use this as a Unique value, since I assume you already have the root data (the UserID and DateTime of Call) stored in your database. Instead, use an AutoNumber field as a surrogate PK field.

    If you want to DISPLAY this on a form or query, just include a concatenated field in your query or form. For example, in a form's Textbox, use this as the ControlSource:

    =YourUserIDField & YourDateTimeField

    You'd obviously have to change it to reflect your actual fields, but this would display your field.

    You can do the same in a query:

    SELECT Col1, Col2, YourUserIDField & YourDateTimeField AS SomeFieldName FROM YourTable

    This would output that concatenated field in your query.

    Author Closing Comment


    I ended up going with =UserID&Now()

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    Suggested Solutions

    In the previous article, Using a Critera Form to Filter Records (, the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
    Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
    Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
    Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …

    746 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

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now