Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

AutoNumber

Posted on 1998-10-06
5
Medium Priority
?
490 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 200 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

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

618 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