How to generate a unique customer ID?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Connor Columbus
    New Member
    • Jan 2011
    • 4

    How to generate a unique customer ID?

    I'm trying to create syntax that will allow me to find the max customer ID from the customer table and then add 1 onto it so that it is completely unique. I would like this to be generated automatically into my add customer form, any ideas?
  • hype261
    New Member
    • Apr 2010
    • 207

    #2
    I would use an autonumber for this. You cannot be absolutely sure that finding this max customer ID from a table and then adding 1 to it will be unique in a multiuser environment.

    If you DB isn't in a multiuser environment then I would still use autonumber because it is just plain easier. Why solve a problem that microsoft has already solved for you.

    Comment

    • Connor Columbus
      New Member
      • Jan 2011
      • 4

      #3
      I understand that this would work yes, but in my exam I am given data sets which start from a high number, so if I did autonumber they would reset to 1, 2, 3 and so on when I really need to find the max that they have given me and then I need to add 1 on so that its unique if you understand.
      Thanks.

      Comment

      • mshmyob
        Recognized Expert Contributor
        • Jan 2008
        • 903

        #4
        We don't answer homework questions here but if your Customer ID's are numeric then try looking into using the MAX function.

        If they are not pure numeric then combine some string functions with the MAX function.

        cheers,

        Comment

        Working...