Results 1 to 6 of 6
  1. #1
    bgeorge12 is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2011
    Location
    Eustis, FL
    Posts
    25

    Auto numbering of forms


    I have a form that is for estimates. When I open the form I wish it to automatically assign the next available number to that form. For example if I am inputting my 10th estimate I want the form to say Estimate #10. How can I do this?

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,926
    You need to store this value in table then use code to look for the max value and increment. This is like creating a custom unique ID. Are there multiple users of this database?

    Tenth estimate in relation to what - single customer, single product, each sales person, that day or week or month or year, the entire database?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    bgeorge12 is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2011
    Location
    Eustis, FL
    Posts
    25
    Single user, 10th estimate of entire database. Can you help with the code?

  4. #4
    bgeorge12 is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2011
    Location
    Eustis, FL
    Posts
    25
    Never mind I finally got it figured out. Thanks anyway

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,926
    Would you like to share the solution?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  6. #6
    bgeorge12 is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2011
    Location
    Eustis, FL
    Posts
    25
    I added a field named Invoice to the form's table, type number and long integer.
    Then I set the control source to that field, and set Devault Value to =GetNextInvoice.
    Then I created:
    Public Function GetNextInvoice()
    'get next free invoice number
    GetNextInvoice=Nz(DMax("[Invoice]","[tblname")+1,1)
    End Function

    I also had to put the number 1 in the table so it had a number to start from.

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

Similar Threads

  1. Auto-Fill one field, two tables, two forms
    By Swilliams987 in forum Forms
    Replies: 1
    Last Post: 01-21-2011, 12:43 PM
  2. Auto fill-in text box on forms
    By windwardmi in forum Forms
    Replies: 7
    Last Post: 09-13-2010, 02:47 PM
  3. Auto Update Forms
    By Vikki in forum Forms
    Replies: 1
    Last Post: 02-09-2010, 10:51 AM
  4. Numbering records
    By knightjp in forum Database Design
    Replies: 0
    Last Post: 08-17-2008, 07:07 AM
  5. Auto Numbering
    By rkruczk in forum Forms
    Replies: 0
    Last Post: 10-09-2006, 04:25 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