Results 1 to 11 of 11
  1. #1
    Join Date
    Jul 2010
    Posts
    14

    Unanswered: Unique ID Numbers

    In Access 2010, there is a column in the database table that is called "ID." Instead of having just numbers, I want it to start with R1 then goes on to R2, R3, R4 and so on so forth for each new entry. How can I do that?

  2. #2
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    If it's always an R, the simplest solution would be to let the autonumber field be the actual ID, but on forms and reports display it to the user with the R:

    ="R" & IDFieldName
    Paul

  3. #3
    Join Date
    Jul 2010
    Posts
    14
    Thanks, Paul! But I have a novice question, where would I enter that code? This field just shows up on the form, so I can't really put it in the "click on" part. Again, thanks for your help!

  4. #4
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    What I posted would be the control source of a textbox. No code needed. There are ways to pad zeros if you want to see "R0001".
    Paul

  5. #5
    Join Date
    Jul 2010
    Posts
    14
    For some reason, when I paste * ="R" & IDFieldName * in the control source on the form, it gives me an error message on the form outside of design view. The actual unique ID is on the form and the unique ID is in a column name "ID" in the database if that helps. Thanks for your help.

  6. #6
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    Did you change "IDFieldName" to the name of your actual field? Sounds like it would be:

    ="R" & ID
    Paul

  7. #7
    Join Date
    Jul 2010
    Posts
    14
    Yes, I tried that, and it still gave me an error. It says "Invalid Control Property: Control Source" then "Circular Reference."

  8. #8
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    Change the name of the control.
    Have a nice day!

  9. #9
    Join Date
    Jul 2010
    Posts
    14
    Thanks everyone! It worked.

  10. #10
    Join Date
    Jul 2010
    Posts
    14
    Hey Paul, how would you pad zeros to see "R0001"?

  11. #11
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    "R" & Format(FieldName, "0000")
    Paul

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •