Results 1 to 5 of 5
  1. #1
    lm_lopes is offline Novice
    Windows Vista Access 2007
    Join Date
    Feb 2010
    Posts
    4

    Help On Creating Automatic of a Serial Number

    I wonder how I can automatically create a serial number for a given product, each time I make a new request.



    I am a manufacturer of a product, so when I make a new request in the factory, I have to generate a new serial number for production.

    By filling out the form with the characteristics of the product, I want, that in the field of serial number (a text box) (which currently put manually) appears automatically a new serial number generated as follows:

    Features Serial Number: RTS0001-10

    RTS: Description of the Model (at the moment is always the same)
    0001: Automated counting
    10: Year abbreviated to two digits

    Can anyone help me on this code?

  2. #2
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    does the automated counting start where the last product number left off?
    is it random instead?

    aside from that issue above, you need to automation coding here. first and last portions stay the same! e.g. - RTS & 10

  3. #3
    lm_lopes is offline Novice
    Windows Vista Access 2007
    Join Date
    Feb 2010
    Posts
    4
    Quote Originally Posted by ajetrumpet View Post
    does the automated counting start where the last product number left off?
    is it random instead?

    aside from that issue above, you need to automation coding here. first and last portions stay the same! e.g. - RTS & 10
    I will try to explain myself better:

    I have this table Request:

    ID (with automated counting by default)
    Serial number (as text box)
    Color (text box)
    Condition (comb box)
    Owner (text box)
    Model (text box)
    ...
    ...
    ..... etc

    Example:

    ID Serial Number Color....
    1 RTS0001-10 Gray.....
    2 RTS0002-10 ......

    In the Year 2011, the Serial number, pass to RTSxxxx-11, but the number XXXX continues counting.

    So what I want is when I make a New Request and open a New Form Request, the field Serial Number is automatic filled with the last value (a new one) and the first value will be RTS0001-10.

    The word "RTS" is always the same, but the "10" no, because it depends of the Date, in this case of the Year (YY)

    I'll appreciate some help

  4. #4
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    i have a solution, but honestly I don't have time to explain it right now. If you upload your database here, I am willing to look at it for you and give you a solution to your problem for free.

  5. #5
    lm_lopes is offline Novice
    Windows Vista Access 2007
    Join Date
    Feb 2010
    Posts
    4
    Quote Originally Posted by ajetrumpet View Post
    i have a solution, but honestly I don't have time to explain it right now. If you upload your database here, I am willing to look at it for you and give you a solution to your problem for free.
    Thanks for trying to help me, in meanwhile I made this code myself:

    I do not know if it will be the best, but it seems to work correctly:

    Private Sub Form_Load()
    If Me.NewRecord Then
    Me.[Serial number] = "RTS" & Format((Nz(DMax("ID", "[table Request]"), 0) + 1), "0000") & "-" & Format(Now(), "yy")
    End If
    End Sub

    Regards

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

Similar Threads

  1. creating automated ticket number
    By speak2des in forum Access
    Replies: 1
    Last Post: 02-25-2010, 11:32 AM
  2. Automatic Serial Numbers
    By Mitch87 in forum Access
    Replies: 9
    Last Post: 02-18-2010, 12:57 PM
  3. Auto Sequence String Serial Number
    By eddyc99 in forum Programming
    Replies: 2
    Last Post: 10-02-2009, 08:11 AM
  4. Replies: 1
    Last Post: 01-31-2009, 10:43 AM
  5. Replies: 5
    Last Post: 02-08-2006, 08:42 PM

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