By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,963 Members | 920 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,963 IT Pros & Developers. It's quick & easy.

Incremental Numbering

P: 1
I am computerizing service tickets - I would like to create an incremental number as one of the fields. In addition I need to be able to set the starting value of the number

Scott
Oct 26 '06 #1
Share this Question
Share on Google+
5 Replies


MMcCarthy
Expert Mod 10K+
P: 14,534
I am computerizing service tickets - I would like to create an incremental number as one of the fields. In addition I need to be able to set the starting value of the number

Scott
This would have to be set programmatically behind the data entry form probably in the On Current event.

Expand|Select|Wrap|Line Numbers
  1.  
  2. Dim tempNum As Integer
  3.  
  4. tempNum=DMax("[ServiceID]","[TableName]")
  5.  
  6. If tempNum=0 or IsNull(tempNum) Then
  7.     Me.ServiceID = 1 ' or whatever number you want
  8. Else
  9.     Me.ServiceID = tempNum + 1
  10. End If
  11.  
  12.  
Oct 26 '06 #2

Expert 5K+
P: 8,434
Would IsNull work on an Integer?
Oct 26 '06 #3

NeoPa
Expert Mod 15k+
P: 31,345
Good spot Killer
Try this (plagiarised shamelessly from MMcCarthy's post)

Expand|Select|Wrap|Line Numbers
  1. 'Any number here to start the count (at conBase + 1)
  2. Private Const conBase As Integer = 0
  3.  
  4. Me.ServiceID = Nz(DMax("[ServiceID]", "[TableName]"), conBase) + 1
Oct 26 '06 #4

MMcCarthy
Expert Mod 10K+
P: 14,534
Thanks guys.

I'm always doing stupid things like that. Feel free to correct any time.


Good spot Killer
Try this (plagiarised shamelessly from MMcCarthy's post)

Expand|Select|Wrap|Line Numbers
  1. 'Any number here to start the count (at conBase + 1)
  2. Private Const conBase As Integer = 0
  3.  
  4. Me.ServiceID = Nz(DMax("[ServiceID]", "[TableName]"), conBase) + 1
Oct 26 '06 #5

NeoPa
Expert Mod 15k+
P: 31,345
Don't think of it like that M.
I always feel extra pleased if I can improve on something you've posted, and that's because of the reputation you've earned for high-quality work.
Oct 26 '06 #6

Post your reply

Sign in to post your reply or Sign up for a free account.