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 » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

auto increment help please?



 
 
Thread Tools Display Modes
  #1  
Old May 10th, 2009, 04:41 AM posted to microsoft.public.access.tablesdbdesign
June7
external usenet poster
 
Posts: 68
Default auto increment help please?

No, cannot auto create this number in table design. I have a similar
situation. Here is code similar to what I use. Modified for you because I
use 4-digit year.
[code]Public Function MyID()

MyID = DLast("ID", "Problem11", "Right(ID,2)=" & Right(DatePart("yyyy",
Now), 2))
If Len(MyID) 1 Then
MyID = Format(Left(MyID, 4) + 1, "0000") & "-" & Right(DatePart("yyyy",
Now), 2)
Else
MyID = "0001-" & Right(DatePart("yyyy", Now), 2)
End If

"norm" wrote:

Is it possible to auto increment a field in a table based on the last 2
digits of year? I am creating a small database for a towing company, and I
need to assign each tow job a specific (unique) ticket number. But I need it
to be based on year for example:

tow
0001-09
0002-09
0003-09
0001-10
0002-10
0003-10
etc....
Is this possible in table design?

Thanks in advance for any help!

Norm

 




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 12:42 AM.


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