Client ID

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Cyberdyne
    Recognized Expert Contributor
    • Sep 2006
    • 627

    Client ID

    Hi guys, I want to make my client ID to appear in this format 06-0001 for client one 06-0002 for client two 06-0003 for client three and so on. I want the number to be generated automatically. here is what I have in the form right now... "06-"0000 but I want to know how to lock it and make it auto number itself with each new client.

    Thanks guys.

    -Cyberdyne
  • PEB
    Recognized Expert Top Contributor
    • Aug 2006
    • 1418

    #2
    Hi CyberDyne,

    The locking of this field is easy... Go in the properties of the control and check the property locked to true

    The autonumbering it's a bit particular and you need a VB code here..

    In the First obligatory field of your Form enter Event procedure for After Update and enter the follow:

    Me![UKey]=Right(Year(Now ()),2)+nz(Dcoun t("*","Customer s","UKey Like '"+Right(Year(N ow()),2)+"*'")) +1


    It's all!

    :)

    Nice luck my frien!

    :)

    Comment

    • Cyberdyne
      Recognized Expert Contributor
      • Sep 2006
      • 627

      #3
      I put the code in so that after the very first entry, which is the client first name the after update follows event procedure with the code

      Me![UKey] = Right(Year(Now( )), 2) + Nz(DCount("*", "Customers" , "UKey Like '" + Right(Year(Now( )), 2) + "*'")) + 1

      but I get an error in the form, do I have to swap Customers with Case# perhaps?

      Tried that and still nothing. What fields should I modify in this code?

      Comment

      • PEB
        Recognized Expert Top Contributor
        • Aug 2006
        • 1418

        #4
        Hi Cyberdyne,

        So here you need to change near everyting ;)

        Me![UKey] = Right(Year(Now( )), 2) + Nz(DCount("*", "Customers" , "UKey Like '" + Right(Year(Now( )), 2) + "*'")) + 1

        UKey with the name of the field where you want to store your key
        Customers with the name of the Table with your clients / Customers

        And there is no more to replace ;)

        Have a nice day my frien!


        Originally posted by Cyberdyne
        I put the code in so that after the very first entry, which is the client first name the after update follows event procedure with the code

        Me![UKey] = Right(Year(Now( )), 2) + Nz(DCount("*", "Customers" , "UKey Like '" + Right(Year(Now( )), 2) + "*'")) + 1

        but I get an error in the form, do I have to swap Customers with Case# perhaps?

        Tried that and still nothing. What fields should I modify in this code?

        Comment

        Working...