Reset Autonumber in VB

G

Guest

My overall goal is to reset an indexed and autonumbered field to zero when I
clear all records from the table from within visual basic code. If anyone
knows a simple way to do this, please let me know! The way I am going about
it is to delete the indexed autonumbered field (ID) from the table and then
reinsert it into the table.

However, since it is indexed I cannot delete it, and once I do delete it, I
cannot add an indexed version. Therefore my second question is, how do I
change the index properties (whether it is an indexed field or not) from
visual basic.

Thank you very much!
 
J

Joseph Meehan

j said:
My overall goal is to reset an indexed and autonumbered field to zero
when I clear all records from the table from within visual basic
code. If anyone knows a simple way to do this, please let me know!
The way I am going about it is to delete the indexed autonumbered
field (ID) from the table and then reinsert it into the table.

However, since it is indexed I cannot delete it, and once I do delete
it, I cannot add an indexed version. Therefore my second question is,
how do I change the index properties (whether it is an indexed field
or not) from visual basic.

Thank you very much!

I suggest you may not want to use Autonumber for that use. Autonumbers
are designed to provide unique numbers. It in not designed to provide
numbers in order and for a number of reasons may not do so. As a result
using them in any application where the user sees the numbers is likely to
end up with confusion.

There are other ways of providing the numbers you want depending on the
particual application.
 

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