473,395 Members | 1,401 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Auto Number Increase

Hi
I'm trying to build a database to hold a CD collection inputting to a Form.

I enter the CD number - no problem there, but would then like to enter a
track number AND increase that number automatically each time after No1.
until I start another CD.

Can I do this automatically and then re-set itself to No 1 when going onto
the next CD record or do I ask the impossible?

Thanks
Alan
Nov 13 '05 #1
2 3731
Sorry, but that's not how autonumbers work. In fact, if you want guaranteed
sequential numbering, you shouldn't use an autonumber at all.

You'll have to "roll your own". What I've done is use a subform for the
individual tracks. In the Current event of that form, I have code that
determines the highest number used so far, and then increments it by one:

Dim intNextNumber

If Not IsNull(Me.Parent!txtDiscID) Then
If IsNull(Me!txtTrackID) Then
intNextNumber = Nz(DMax("TrackID", "Tracks", "DiscID = " &
Me.Parent!txtDiscID), 0) + 1
Me!txtTrackID = intNextNumber
End If
End If

txtDiscID is the name of the text box on the parent form that contains the
number of the CD, while txtTrackID is the name of the text box on the
subform where the TrackID is displayed.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

"a.p.mews" <a.******@btinternet.com> wrote in message
news:cv**********@sparta.btinternet.com...
Hi
I'm trying to build a database to hold a CD collection inputting to a
Form.

I enter the CD number - no problem there, but would then like to enter a
track number AND increase that number automatically each time after No1.
until I start another CD.

Can I do this automatically and then re-set itself to No 1 when going onto
the next CD record or do I ask the impossible?

Thanks
Alan

Nov 13 '05 #2
Hi
Thanks.
Thought I was on the wrong track with it. I've been around simple DBs for
years but now I want to TRY and learn more about Access and this was an idea
I dreamed up to tax my brain.

Alan
"a.p.mews" <a.******@btinternet.com> wrote in message
news:cv**********@sparta.btinternet.com...
Hi
I'm trying to build a database to hold a CD collection inputting to a
Form.

I enter the CD number - no problem there, but would then like to enter a
track number AND increase that number automatically each time after No1.
until I start another CD.

Can I do this automatically and then re-set itself to No 1 when going onto
the next CD record or do I ask the impossible?

Thanks
Alan

Nov 13 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: dave | last post by:
I have one auto number field in one table in sql server 2000. I'm inserting new record using insert statement and am not giving any value for that field as its auto number. On the very next...
1
by: Ken | last post by:
Need help on the Auto Number or Identity Seed on the Oracle Database I got an Access database that need to be converted to Oracle 9i. Somehow the Trigger we created to simulate the "AUTO NUMBER"...
2
by: Irwinsp | last post by:
Hi All, I have a form with an auto number field displayed. The field looks great except when the user is entering a new record. The field then has the text "auto number" in it. Is there a...
5
by: Geoff Cayzer | last post by:
At http://www.blueclaw-db.com/tips_tricks.htm I came across a section which is included below and was hoping for some comment on the article. -------------- Almost never use this auto-number...
16
by: John Baker | last post by:
Hi: I know this is a strange question, but I have inherited a system where files are copied and records re auto numbered (as an index field) )frequently, and I am wondering how high the number...
2
by: Mike N. | last post by:
Hello- I have a database that uses an auto number field type that goes out of sync periodically. My customer gets a "cannot add record, number already in use" error message. I dump the records...
4
by: Shahar | last post by:
Hi I need to get a field name 'ID'(that is an auto-number field) right after I add a new row to table, it's work like that: myCommand.ExecuteNonQuery(); myCommand.CommandText = "SELECT...
13
by: S.Dickson | last post by:
I had an access database that i use as an ordering system. I have a form for entering customer details. When i add a new customer on the form the customer number is an auto number that appears when...
3
by: Wayne L | last post by:
Ok now everyone has mentioned not to use auto number if it means anything to the user. My application uses the auto number for exporting only. I append the mastertbl column with my starting number of...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.