Results 1 to 3 of 3
  1. #1
    banpreet is offline Competent Performer
    Windows 8 Access 2010 64bit
    Join Date
    Jul 2016
    Posts
    117

    Use a Query to generate auto ID

    Hi Guys,



    I would like to create a button that will run a query based on what user chooses on a form that will automatically create a unique Id for them. I don't know if I should use vba or if its simply easier to use a query. I have a table with these fields [Requestor_LName] [RequestorFirstName] [Requestor_Clock_Number] [Date] [Model] and [GTSR_ID]. I have put these all on a form and want the GTSR_ID field linked to a button that will run the query. GTSR_Id is the primary key and the [Model] field is a combo box with bunch of the options the user chooses. I want to ID format to be generated "GT-(the model the user chooses)-16(the year)-001". After 001, the button will increment 001 to 002 to 003 and so on. How can I do this with simply create a query?

    Thanks, all help is appreciated.

  2. #2
    ranman256's Avatar
    ranman256 is online now VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,524
    let the table generate the autoID, also create YOUR ID. (i think youre putting too much effort into an ID where the table can do it for you)
    You cant create multiple id via a query. It cant generate 1,2,3, etc via query.
    It CAN do this 1 record at a time. It can calculate 1,2,3 if appending 1 record.
    I would use
    "GT-(the model the user chooses)-16(the year)-" & AUTOID

    Like I said, more work than you need to get an ID.

  3. #3
    banpreet is offline Competent Performer
    Windows 8 Access 2010 64bit
    Join Date
    Jul 2016
    Posts
    117
    I could let the table generate ID, but we want to user to autogenerate the id on the form on its own instead of assigning them from the table, so then they can fill the forms after that. Where would I put "GT-(the model the user chooses)-16(the year)-" & AUTOID in? And how do I make sure the model will be linked to the combo box depending on what model the user chooses? Thanks!

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

Similar Threads

  1. auto generate a 5 digit number?
    By Andre73 in forum Access
    Replies: 2
    Last Post: 02-18-2015, 07:45 AM
  2. Auto Generate field only when needed
    By mrmims in forum Programming
    Replies: 5
    Last Post: 10-06-2014, 10:35 PM
  3. Auto generate records
    By RokitRod in forum Database Design
    Replies: 1
    Last Post: 10-02-2012, 10:45 AM
  4. Auto Generate Record
    By mjhopler in forum Forms
    Replies: 2
    Last Post: 02-10-2010, 03:40 PM
  5. Replies: 1
    Last Post: 10-01-2009, 06:41 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