Access97 Record Locking

K

katz

Hello!
I'm creating about a 1000 records at a time to a table thru code. I want the
RecordNo's should be in sequence and I don't want other user should add new
records until I'm done. I would like to lock the table in the beginning of
the processing and release when I'm done. Can anybody show me and give me an
example how to lock and unlock a table thru code!

Thanks
Abek katz
 
J

John Vinson

Hello!
I'm creating about a 1000 records at a time to a table thru code. I want the
RecordNo's should be in sequence and I don't want other user should add new
records until I'm done. I would like to lock the table in the beginning of
the processing and release when I'm done. Can anybody show me and give me an
example how to lock and unlock a table thru code!

Thanks
Abek katz

As Panja says, don't confuse an Autonumber value with a "record
number". It isn't one. An Autonumber has one purpose, and one purpose
only: to provide a unique key. It is NOT guaranteed to be sequential
or to be free of gaps, and should not be used in a way which depends
on that assumption!

That said... open a Recordset exclusively. Look at the VBA help for
the OpenRecordset method. If you open it, add your records, and then
close it, your numbers should be sequential within that block (no
guarantees about gaps outside the block though).

John W. Vinson[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