Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Queries / May 2005

Tip: Looking for answers? Try searching our database.

How can I create consecutively numbered invoices?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Training Changes - 04 May 2005 11:13 GMT
How can I create consecutively numbered invoices?
John Vinson - 04 May 2005 18:26 GMT
>How can I create consecutively numbered invoices?

Depends. Is this a one-user desktop system, or a networked realtime
database with thirty users creating invoices all at the same time?

If the former, you can do your invoice entry on a Form (tables and
queries don't have any usable events). Put the following VBA code in
the Form's BeforeInsert event (using your own table and fieldname of
course):

Private Sub Form_BeforeInsert(Cancel as Integer)
Me!InvoiceID = NZ(DMax("[InvoiceID]", "[Invoices]")) + 1
End Sub

This will look up the maximum value of InvoiceID in the table
Invoices; return a 0 if there are no records yet; add 1 to the result
and store that value in the textbox named InvoiceID on your form.

                 John W. Vinson[MVP]    
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.