Solved

AutoNumber

Posted on 1998-10-06
5
486 Views
Last Modified: 2008-03-06
Have a old database with 4000 records from last fiscal year, need to start new fiscal year to same database, but want to add a autonumbering field.  The autonumbering sequence automatically counts all previous records.  I need to start a "0000" new sequence to the new FY without it taking in to affect the previous year... Help!
0
Comment
Question by:drew77
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 3

Expert Comment

by:vmano
ID: 1964532
refer to the previously asked questions in EE.
http://experts-exchange.com/topics/comp/lang/vbdatabases/Q.10084353

let me know if this helps
vmano
0
 
LVL 1

Expert Comment

by:ghjm
ID: 1964533
If I understand you correctly, you are saying you want a field that shows zero or null for records from prior years, but shows an incrementing autonumber starting at the beginning of this year.

There is no way to make an autonumber behave like that on a single table. However, what you can do is create two tables and then use a union query to make them appear like a single table for purposes of reporting, etc.

For testing, I created two tables. One has two string fields, "key" and "value". The other has the same two fields plus an autonumber field called "seq". The following SQL query will return a single result set that gives all data with zero values for "seq" for records that came from the old table:

SELECT key, value, 0 AS seq FROM TABLE1
UNION SELECT key, value, seq FROM TABLE2;

The problem with this approach, of course, is that queries are read-only. However, I assume that your prior year data is closed out and won't be changed at this point, so it might be acceptable to point your data entry screens at the new table and simply ignore last year's data. Reporting is no problem because reports can run off queries.

Hope this helps...

-Graham
0
 
LVL 1

Expert Comment

by:ghjm
ID: 1964534
If I understand you correctly, you are saying you want a field that shows zero or null for records from prior years, but shows an incrementing autonumber starting at the beginning of this year.

There is no way to make an autonumber behave like that on a single table. However, what you can do is create two tables and then use a union query to make them appear like a single table for purposes of reporting, etc.

For testing, I created two tables. One has two string fields, "key" and "value". The other has the same two fields plus an autonumber field called "seq". The following SQL query will return a single result set that gives all data with zero values for "seq" for records that came from the old table:

SELECT key, value, 0 AS seq FROM TABLE1
UNION SELECT key, value, seq FROM TABLE2;

The problem with this approach, of course, is that queries are read-only. However, I assume that your prior year data is closed out and won't be changed at this point, so it might be acceptable to point your data entry screens at the new table and simply ignore last year's data. Reporting is no problem because reports can run off queries.

Hope this helps...

-Graham
0
 

Author Comment

by:drew77
ID: 1964535
Sorry, VMANO...  The previously answered question refers only to a start number base.  What I need is a autonumbering sequence on the same table.  Furthermore, I have received other suggestions to suggest combining two tables and using a union query to act as one.  I tried that before, but was just missing it somewhere.  I've gotten some suggestions on that same option...I'll be trying that.  Thanks again....

Drew...
0
 
LVL 1

Accepted Solution

by:
rholmes earned 100 total points
ID: 1964536
Set both fields to Long Integer fields. That will lock FY1 fields and discontinue the counting. Set the DefaultValue on FY2 to =DMax+1.Since its a Long Integer field it should start the numbering @ 1, etc.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

735 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question