A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

using sequential numbers for documents



 
 
Thread Tools Display Modes
  #1  
Old October 3rd, 2009, 06:11 AM posted to microsoft.public.access.gettingstarted
snimmuc
external usenet poster
 
Posts: 6
Default using sequential numbers for documents

Your help please. I want to sequentially number a series of receipts, for
customers who buy from us. I have set up a form to select the product (work
of art) and I have also set up a Report to print the Receipt. Two questions -
How and where do I store the coding to generate a sequential number for the
receipts? Second question is there a more user friendly way to select the
record to be printed than using a Query. Final question (that's three), what
code should I use ? I am new to Access. I've got this far OK, but I cannot
work out a solution to the above. Thank You.
  #2  
Old October 3rd, 2009, 02:23 PM posted to microsoft.public.access.gettingstarted
Arvin Meyer [MVP][_2_]
external usenet poster
 
Posts: 2,310
Default using sequential numbers for documents

There are so many different ways to do this. Keep in mind, however, that if
a record in the sequence is deleted, a hole will remain that must be ignored
or manually filled,

Probably the easiest way is to look and see what the last number is and add
1 to it. Use this to create a default value for that record, so it won't be
used unless you start typing the record:

Private Sub Form_Current()
On Error Resume Next
Dim x As Integer
x = DMax("ProviderNumber", "tblProviders", "ID =" & Me.txtID)

If IsNull(x) Then
Me!txtProviderNumber.DefaultValue = 1
Else
Me!txtProviderNumber.DefaultValue = x + 1
End If

End Sub
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

"snimmuc" wrote in message
...
Your help please. I want to sequentially number a series of receipts, for
customers who buy from us. I have set up a form to select the product
(work
of art) and I have also set up a Report to print the Receipt. Two
questions -
How and where do I store the coding to generate a sequential number for
the
receipts? Second question is there a more user friendly way to select the
record to be printed than using a Query. Final question (that's three),
what
code should I use ? I am new to Access. I've got this far OK, but I cannot
work out a solution to the above. Thank You.



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 05:59 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.