Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
Microsoft Access
»
Microsoft Access
»
Incremental Number
15 posts, Page 1 of 2
1
2
»»
Incremental Number
Rate Topic
Display Mode
Topic Options
Author
Message
sasansamani
sasansamani
Posted Wednesday, November 28, 2012 10:03 PM
SSC Rookie
Group: General Forum Members
Last Login: Friday, January 11, 2013 11:52 AM
Points: 28,
Visits: 50
lets say I want to increment 0000 to 9999. I know how do this.
how would you identify if I have used that number?
How would you tell the field in the form to populate the numbers you haven't used?
I guess my second question and third question are related.
Post #1390273
ProofOfLife
ProofOfLife
Posted Thursday, November 29, 2012 4:47 PM
SSC Rookie
Group: General Forum Members
Last Login: Thursday, February 21, 2013 9:11 PM
Points: 45,
Visits: 9,440
Hi
I'm sorry to answer your questions with a question but we need to know what method you are using to increment from 0000 to 9999.
If you are using an auto increment data type (that is incrementing by 1) then the answer is simple - use a max (query) or dmax (VBA) function. If you are using code to do it and the numbers aren't sequential then it gets more complex.
The answer will also depend on whether you are attempting to do this in a query or VBA.
Cheers
Rowan
Post #1390913
sasansamani
sasansamani
Posted Friday, November 30, 2012 12:42 PM
SSC Rookie
Group: General Forum Members
Last Login: Friday, January 11, 2013 11:52 AM
Points: 28,
Visits: 50
how would you identify if I have used that number?
How would you tell the field in the form to populate the numbers you haven't used?
I would like to this in a query.
Post #1391511
Sean Lange
Sean Lange
Posted Friday, November 30, 2012 12:50 PM
SSCrazy Eights
Group: General Forum Members
Last Login: Today @ 2:33 PM
Points: 8,620,
Visits: 8,261
If you are using an autonumber you are going to have gaps. This is perfectly normal. Honestly, why does it matter if there are gaps?
_______________________________________________________________
Need help? Help us help you.
Read the article at
http://www.sqlservercentral.com/articles/Best+Practices/61537/
for best practices on asking questions.
Need to split a string? Try Jeff Moden's
splitter
.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Post #1391517
sasansamani
sasansamani
Posted Friday, November 30, 2012 1:13 PM
SSC Rookie
Group: General Forum Members
Last Login: Friday, January 11, 2013 11:52 AM
Points: 28,
Visits: 50
Actually my autonumber starts at 1000. You are right. How do I automatically assign random numbers for a 4 or 5 digit number? How do I determine if I have used that number before in the table?
00000-V/C
0000
- AT-YR
Post #1391531
sasansamani
sasansamani
Posted Friday, November 30, 2012 1:22 PM
SSC Rookie
Group: General Forum Members
Last Login: Friday, January 11, 2013 11:52 AM
Points: 28,
Visits: 50
Basically what I am doing is I am parsing 0000-V/C 0000-AT-YR and then putting each section into its field in a table. I need to know how I can determine if that asset number have been used before? If that number has nerver been used then it needs populate into the form field called Asset.
In other words, How do I validate against another table? Do I use DCount Function?
Post #1391537
Sean Lange
Sean Lange
Posted Friday, November 30, 2012 1:32 PM
SSCrazy Eights
Group: General Forum Members
Last Login: Today @ 2:33 PM
Points: 8,620,
Visits: 8,261
sasansamani (11/30/2012)
Actually my autonumber starts at 1000. You are right. How do I automatically assign random numbers for a 4 or 5 digit number? How do I determine if I have used that number before in the table?
00000-V/C
0000
- AT-YR
If it is an autonumber you don't. That is the point of it being automatic...you don't have to do anything.
_______________________________________________________________
Need help? Help us help you.
Read the article at
http://www.sqlservercentral.com/articles/Best+Practices/61537/
for best practices on asking questions.
Need to split a string? Try Jeff Moden's
splitter
.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Post #1391539
sasansamani
sasansamani
Posted Friday, November 30, 2012 1:43 PM
SSC Rookie
Group: General Forum Members
Last Login: Friday, January 11, 2013 11:52 AM
Points: 28,
Visits: 50
I made myself confused and you. I need more coffee. I thought you were referrring to another field.
Right now my problem is how do I validate against another table? How do I tell the form field to show me numbers I havent used before?
Post #1391543
Sean Lange
Sean Lange
Posted Friday, November 30, 2012 1:57 PM
SSCrazy Eights
Group: General Forum Members
Last Login: Today @ 2:33 PM
Points: 8,620,
Visits: 8,261
sasansamani (11/30/2012)
I made myself confused and you. I need more coffee. I thought you were referrring to another field.
Right now my problem is how do I validate against another table? How do I tell the form field to show me numbers I havent used before?
MAX(Field) + 1 ???
_______________________________________________________________
Need help? Help us help you.
Read the article at
http://www.sqlservercentral.com/articles/Best+Practices/61537/
for best practices on asking questions.
Need to split a string? Try Jeff Moden's
splitter
.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Post #1391550
sasansamani
sasansamani
Posted Friday, November 30, 2012 2:52 PM
SSC Rookie
Group: General Forum Members
Last Login: Friday, January 11, 2013 11:52 AM
Points: 28,
Visits: 50
SELECT DMax("[AssetNumber]","Waste Hauler Number","+1") AS Expr1 FROM [Waste Hauler Number];
I am getting two 4001. What I am doing incorrectly? I have 4000 and 4001
Post #1391565
« Prev Topic
|
Next Topic »
15 posts, Page 1 of 2
1
2
»»
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.