Unique Id

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • geraldinegrieve
    New Member
    • Jul 2008
    • 14

    Unique Id

    I have a unique ID that looks like this ABCD0000ID e.g 3 letters, 6 digit number with leading zero's and I want to increment number by 1 each time automatically, but with a text format this doesn't seem possible. Any help much appreciated .
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    How Are You Trying To Generate That ?

    Comment

    • geraldinegrieve
      New Member
      • Jul 2008
      • 14

      #3
      Originally posted by debasisdas
      How Are You Trying To Generate That ?
      Thanks for your reply I am tryint to set it up in a unique id field on a form was thinking about dividing in 2 e.g. prefix and id but don't know how to generate leading 0's

      Comment

      • debasisdas
        Recognized Expert Expert
        • Dec 2006
        • 8119

        #4
        U Need To Use Format Function For That.

        Comment

        • geraldinegrieve
          New Member
          • Jul 2008
          • 14

          #5
          Originally posted by debasisdas
          U Need To Use Format Function For That.
          sorry for being such a pest but how and where do you mean format([uniqueID])

          Comment

          • debasisdas
            Recognized Expert Expert
            • Dec 2006
            • 8119

            #6
            tell me first are you using VB 6.0

            Comment

            • geraldinegrieve
              New Member
              • Jul 2008
              • 14

              #7
              Originally posted by debasisdas
              tell me first are you using VB 6.0
              I am using Version 6.3

              Comment

              • debasisdas
                Recognized Expert Expert
                • Dec 2006
                • 8119

                #8
                Originally posted by geraldinegrieve
                I am using Version 6.3
                From where you got Visual Basic version 6.3 ???

                Comment

                • geraldinegrieve
                  New Member
                  • Jul 2008
                  • 14

                  #9
                  Originally posted by debasisdas
                  From where you got Visual Basic version 6.3 ???
                  I just using the version from within access

                  Comment

                  • 9815402440
                    New Member
                    • Oct 2007
                    • 180

                    #10
                    hi

                    there are two ways out. first is add a numeric field in the table. this field will store numeric part of the id. now genrate id as follows
                    dim rst as new adodb.recordset
                    rst.open select max(numFiled) from table
                    unique id = "ABCD" & format(rst.fiel ds(0).value,"00 00#") & "ID"

                    second way is:
                    1. dim intCtr as integer
                    2. intCtr = (load intCtr value from registry or file etc. that is saved in line 5)
                    3. intCtr = intCtr+1
                    4. unique id = "ABCD" & format(intCtr," 0000#") & "ID"
                    5. save intCtr to registry or file etc.

                    hope this will help you

                    regards
                    manpreet singh dhillon hoshiarpur

                    Comment

                    • geraldinegrieve
                      New Member
                      • Jul 2008
                      • 14

                      #11
                      Many Thanks for that sorry I didn''t reply sooner but out of office for a few days
                      Originally posted by 9815402440
                      hi

                      there are two ways out. first is add a numeric field in the table. this field will store numeric part of the id. now genrate id as follows
                      dim rst as new adodb.recordset
                      rst.open select max(numFiled) from table
                      unique id = "ABCD" & format(rst.fiel ds(0).value,"00 00#") & "ID"

                      second way is:
                      1. dim intCtr as integer
                      2. intCtr = (load intCtr value from registry or file etc. that is saved in line 5)
                      3. intCtr = intCtr+1
                      4. unique id = "ABCD" & format(intCtr," 0000#") & "ID"
                      5. save intCtr to registry or file etc.

                      hope this will help you

                      regards
                      manpreet singh dhillon hoshiarpur

                      Comment

                      Working...