create an Auto-increment field for use as the primary index betwee

H

HJT

I'm considering converting an older, yet extremely useful, database from
Alpha4-Version 6 to MS ACCESS. In the old databse, I have a primary field
used to tie the individual tables together in the database that
"auto-increment" when new records are added -- EX: if "CA-1234" is the
primary key in the last record in the table, when I go to enter a new record
in the table, the application creates the primary index field with "CA_1235"
automatically. I'm a novice to MS ACCESS and can't seem to find how to get
this to happen in MS ACCESS. Does this "Auto-Increment" feature exist in MS
ACCESS? If so, how to I make it happen? All I can find in MS ACCESS is an
"Auto-Number" feature.
 
R

Roger Carlson

Autonumber is the equivalent function in Access. However, you do not have
control of the format or value of an autonumber field in Access. It can
also develop "gaps" if a record is created, yet never saved. This is by
design. You do not need a real-world value to maintain referential
integrity between records in related tables. Using a made-up,
system-created value avoids complications down the road when naming
conventions change.

If you still want an incremented value for the user, to see, however, you
can create one with the DCount function in a form. On my website
(www.rogersaccesslibrary.com), is a small Access database sample called
"AutonumberProblem.mdb" which illustrates how to do this. You can find it
here: http://www.rogersaccesslibrary.com/forum/forum_posts.asp?TID=395.

--
--Roger Carlson
MS Access MVP
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top