Page 1 of 3 123 LastLast
Results 1 to 15 of 31
  1. #1
    tchirpich is offline Novice
    Windows XP Access 2007
    Join Date
    Dec 2011
    Posts
    15

    Post Enter new number in sequence in PO

    I have a po form that I have in access 2007 and I am having trouble getting the right
    verbage to get to the next number,
    my po number are as follows, 10191,10192,10193,etc.
    When I put in the formula that you have on the website I get a error in that field.
    My table field for that stored number is PO Number. Is it possible that you can edit the
    formula so that it will work for me. Also the table name is Purchase Orders.
    I can send you the more information if needed.
    Nz(DMax("NumberField", "TableName", "DateField = " & Year(Date())), 0) + 1



    Thank You,
    Tim Chirpich

  2. #2
    alansidman's Avatar
    alansidman is offline VIP
    Windows 7 32bit Access 2007
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,529
    Try this:

    NZ(Dmax("NumberField","TableName")+1,0)

  3. #3
    Robeen is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Mar 2011
    Location
    Tulsa, Oklahoma.
    Posts
    1,596
    What is the error you are getting?

    I created a TextBox [txtMax_Number] on a Form and in the Form Load event of the Form, I put this code:

    Code:
     
    Private Sub Form_Load()
     
    Me.txtMax_Number.SetFocus
    Me.txtMax_Number.Text = Nz(DMax("NumberField", "[TableName]", "Year([DateField]) = " & Year(Date)), 0) + 1
     
    End Sub
    You'll notice that I put the Year function for the DateField ["Year([DateField]) = . . .]

    The above code gave me the next highest number.

    Let me know if this helps!

  4. #4
    tchirpich is offline Novice
    Windows XP Access 2007
    Join Date
    Dec 2011
    Posts
    15

    Purchase order

    Quote Originally Posted by alansidman View Post
    Try this:

    NZ(Dmax("NumberField","TableName")+1,0)
    Do I have to change the number field and table name to what I have in my Database??????

  5. #5
    alansidman's Avatar
    alansidman is offline VIP
    Windows 7 32bit Access 2007
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,529
    Absolutely. I just used what you provided.

    BTW: I put it as a default value in the form property for the text box control.

  6. #6
    tchirpich is offline Novice
    Windows XP Access 2007
    Join Date
    Dec 2011
    Posts
    15
    I still get a error when I use this formula, something I am doing is not right.
    NZ(DMax("PO Number","Purchase Orders")+1,0)?????
    It still gives me error in that field when I open up the Purchase order form.

  7. #7
    RayMilhon is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Aug 2011
    Location
    Southern California
    Posts
    1,071
    Since you have spaces in your tablename and Numberfield don't forget the [] around them. Look at Robeens sample

  8. #8
    tchirpich is offline Novice
    Windows XP Access 2007
    Join Date
    Dec 2011
    Posts
    15

    po

    Quote Originally Posted by alansidman View Post
    Absolutely. I just used what you provided.

    BTW: I put it as a default value in the form property for the text box control.
    Nothing is working for me If I send you my database can you get it to work for me??

  9. #9
    Robeen is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Mar 2011
    Location
    Tulsa, Oklahoma.
    Posts
    1,596
    Put your db out here. One of us will look at it.

  10. #10
    tchirpich is offline Novice
    Windows XP Access 2007
    Join Date
    Dec 2011
    Posts
    15

    POrders

    Quote Originally Posted by Robeen View Post
    Put your db out here. One of us will look at it.
    It will not let me load it because it is to large 2.38MB
    any other ideas???

  11. #11
    Robeen is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Mar 2011
    Location
    Tulsa, Oklahoma.
    Posts
    1,596
    You'll have to zip it.

  12. #12
    tchirpich is offline Novice
    Windows XP Access 2007
    Join Date
    Dec 2011
    Posts
    15

    PO Order

    Quote Originally Posted by Robeen View Post
    You'll have to zip it.
    Here it is.
    Purchase order zip

    Please help

  13. #13
    Robeen is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Mar 2011
    Location
    Tulsa, Oklahoma.
    Posts
    1,596
    Where are you trying to put that formula in?

    And what are you trying to do with that formula?

  14. #14
    tchirpich is offline Novice
    Windows XP Access 2007
    Join Date
    Dec 2011
    Posts
    15
    Quote Originally Posted by Robeen View Post
    Where are you trying to put that formula in?

    And what are you trying to do with that formula?
    Under the Purchase order form
    in the box that request a PO Number.
    If you click on New Purchase order it opens a blank
    form saying new. When you hit enter it assigns a po id and then
    the next line I want it to assign the next po number in sequence,
    ie 10191, then next number would be 10192 without manually having
    to enter that number in that field. I hope you can help.

    Tim

  15. #15
    Robeen is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Mar 2011
    Location
    Tulsa, Oklahoma.
    Posts
    1,596
    Is this Form ONLY for Data Entry?

    If so - then it should not be a problem.

Page 1 of 3 123 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 11-21-2011, 10:48 AM
  2. how to auto inset sequence number at column
    By newaccess in forum Access
    Replies: 1
    Last Post: 04-01-2011, 06:55 PM
  3. Yes/No, If yes Enter Number
    By kennyrogersjr in forum Forms
    Replies: 1
    Last Post: 11-29-2010, 07:37 PM
  4. Find Missing Number in Sequence per Record
    By escuro19 in forum Programming
    Replies: 1
    Last Post: 11-10-2009, 03:15 PM
  5. Auto Sequence String Serial Number
    By eddyc99 in forum Programming
    Replies: 2
    Last Post: 10-02-2009, 08:11 AM

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