Results 1 to 12 of 12
  1. #1
    deepucec9 is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2015
    Posts
    34

    Concatinate autonumber

    Hi,



    I would like to join autonumber field and a text and save it to another field.
    For example
    Autonumber 1 2 3 44
    test_field w1 w2 w3 w44

    tried "W"+""[autonumber] in test_field format, but its not working. Please help
    Thanks in advance

  2. #2
    Micron is offline Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,834
    Where are you getting the values from, a query? If so, I think a calculated query field would work: Expr1: "W" & Cstr([NameOfAutonumberField]). You don't have to display the two fields that you are concatenating if you don't want to see all 3 of them. Of course, you could give the field a more meaningful name than Expr1.

  3. #3
    deepucec9 is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2015
    Posts
    34
    Not from query, it is updated from form to table. I need to create a job number prefix "W" followed by autonumber.
    Tried "W"& in table -> autonumber -> format, it worked fine, but when I select this autonumber in form using a comboxbox, it shows "invalid format"

  4. #4
    Micron is offline Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,834
    To the best of my knowledge, a table autonumber field can only be a long integer type, so I fail to see how you could preface it with a letter. Unless I misunderstand and you're creating a concatenated field in the table (which I would not do).

    OK then - more info needed about the form.
    Is it bound to a query or directly to the table?
    Are you using it to add or edit records (or both)?
    Is it a single form or datasheet or what?
    Regardless, I think your table needs a field of text type to hold the concatenated value.

  5. #5
    deepucec9 is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2015
    Posts
    34
    It is bound directly to table,
    And I want to edit the record from form, when the added a combo box to edit/update the record it is not working.
    When I select the jobnumber using combo box, it should auto fill all the fields in the form and user could update as needed.

  6. #6
    Micron is offline Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,834
    I'm not sure I can help you. I ask 3 questions, you answer 1. I have no idea what you're working with.
    Best I can say is, on the After_Update event for the combo box, write some code that alters the values in the controls you want to update.
    Or base your form on a query instead, and requery the form using the combo box value that you seem to be able to generate now. That will automatically 'refresh' what you see in the form controls.

  7. #7
    orange's Avatar
    orange is online now Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,746
    Like micron, I am confused with what you are trying to do. Can you tell us in plain English business terms (no Access jargon) what you are trying to do? There may be some options. But we won't know until we're all clear on what it is you are trying to do.

    An autonumber is a unique identifier. Why do you want to prefix it with an alphabetic? In business terms?

  8. #8
    InsuranceGuy is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Aug 2015
    Location
    Colorado
    Posts
    126
    Quote Originally Posted by deepucec9 View Post
    Hi,

    I would like to join autonumber field and a text and save it to another field.
    For example
    Autonumber 1 2 3 44
    test_field w1 w2 w3 w44

    tried "W"+""[autonumber] in test_field format, but its not working. Please help
    Thanks in advance
    In the table definition, for your [test_field] properties, set a default value of:

    Code:
    ="W" & [AutonumberFieldName]

  9. #9
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Before proceeding, you should read this:

    Autonumbers--What they are NOT and What They Are
    http://www.utteraccess.com/wiki/index.php/Autonumbers

  10. #10
    deepucec9 is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2015
    Posts
    34
    tried ="W" & [ID]
    but gives error on saving "the database engine does not recognize either the field ID in a validation expression, or the default value in the table "table_name"

  11. #11
    deepucec9 is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2015
    Posts
    34
    Sorry, will will explain what im trying to do
    Would like to create a sequential job number in the format W10, W11. The numeric part increments everytime.
    So I created a new column "jobnumber" and trying to set the default value as "W+[ID]"

  12. #12
    orange's Avatar
    orange is online now Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,746
    Why do you want "W" as leading character on sequential job number?
    Can you tell us more about the business this database will support?

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

Similar Threads

  1. autonumber
    By kelvinkind in forum Access
    Replies: 1
    Last Post: 06-26-2014, 10:24 PM
  2. Replies: 4
    Last Post: 11-21-2013, 05:06 PM
  3. Autonumber changes
    By wizardnick in forum Access
    Replies: 5
    Last Post: 09-22-2013, 08:58 AM
  4. Help with autonumber
    By GDubbs780 in forum Programming
    Replies: 15
    Last Post: 02-27-2011, 02:27 PM
  5. Concatinate data from seperate table
    By ntonline in forum Forms
    Replies: 2
    Last Post: 01-28-2011, 11: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