AutoNumber

G

Guest

1. I have a problem when coding AutoNumber on a text box
on a form. Example if I have some ID of students: E001,
E002, E003, E004, E005 if I delete E003 then ID in table
become E001, E002, E004, E005 so how should I do to make
it change to E001,E002,E003,E004 ?

2. Please help coding for Printing a document and briefly
explain it if possible.

Chhunhour,
Cambodia.
 
L

Larry Linson

1. I have a problem when coding AutoNumber on a text box
on a form. Example if I have some ID of students: E001,
E002, E003, E004, E005 if I delete E003 then ID in table
become E001, E002, E004, E005 so how should I do to make
it change to E001,E002,E003,E004 ?

The values you describe are not "AutoNumber" values, because it is Long
Integer, numeric only. If you really mean an all-numeric value, then what
you want is not the way that AutoNumber is designed or intended to work, and
certainly not the way it does work. An AutoNumber field is intended for
internal use in joining related tables, and should never be shown to the
user. It does not, and should not, matter what the value is, only that it is
unique -- in fact, there is even a GUID option where the values make no
pretense of being sequential.

Why would you want to reuse the ID of a deleted record? To accomplish what
you want would require renumbering all the following records, and, likely,
all the foreign keys in other tables that refer to the renumbered records,
too. If this is a "Student ID" that is used on things like identity cards,
book issue slips, etc., it would seem to me that "closing up the sequence"
would cause chaos in the real world. E.g., "John, I know that you have had
the number E352 for the last several months, but from now on, your student
number will be E340, because we had 12 students who either flunked out or
transferred to other schools. Please go get your new student identification,
revised library card, ..."
2. Please help coding for Printing a document and briefly
explain it if possible.

It is better to confine your questions to a single topic. Reporting
questions would be more appropriate for the microsoft.public.access.reports
newsgroup.

I assume that you mean "printing a Report", since that is the kind of Access
"document" that is normally printed (Forms can be printed, but that isn't
really their purpose). I have rarely had occasion to print a document
directly... I normally display the report in Preview, and allow the user to
decide whether it is ready to be printed, or if they need to do some more
work. Check Help for DoCmd.OpenReport for either Preview or directly
Printing.

Larry Linson
Microsoft Access MVP
 

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