Advertisement         >> Go to tutorial

vbWatchdog - Global Error Handler

Transform your VBA error handling.  vbWatchdog offers a robust mechanism for
catching and logging errors that occur in your VBA code on a global scale.

  • No DLLs required - vbWatchdog is coded neatly inside your VBA environment
  • Allows you to log the full callstack that lead up to the exception
  • Reports the values of variables within each procedure on the callstack
  • Offers a Try-Catch paradigm for simplifying local error handling
  • Prevents the Access Runtime from closing on unhandled errors
  • List the exact line number to identify the line of code that failed

Download the FREE Trial             Sample.MDB

 

Your VBA error dialogs could look like this:

vbWatchdog Error Dialog Example


Using AutoNumbers properly

by Keri Hardwick, 01 January 1999
Applies to: All versions
User Level: ALL
Views: 1,768
Rating: ***  (8 votes)
Comments: 0   Have your say...

(Q)     In a table I'm using an Autonumber Field as the primary ID.   But if the user creates a new record and closes the form without saving it,   the Autonumber field still increases by one. This creates gaps in the continuity of the primary key field. How can I:

(a)  stop the Autonumber incrementing itself if the record wasn't created; and
(b)  force a renumber of this field to occupy contiguous numbers if I was delete record(s) from the table?

(A)   There is no such thing as a record number in Access.

Records just "are" - a table is a big, unsequenced bucket. Indexes and queries provide order to the records in the bucket.

Autonumber is simply a way to create a unique identifier for each record. It should NEVER be treated as a meaningful piece of data.

If you need a meaningful sequencer (like to assign user numbers), you have to create it and manipulate it yourself. You will need to stop using Autonumber, and create a sequence number that you increment yourself and apply to the record when it is saved.

You can also capture the numbers from deleted records and re-use  them. If, however, you have the possibility of related records using the number as a foreign key - do not reuse old numbers.

Now, for your db to "work" primary keys do not need to be continuous numbers; they just need to be unique - which is why the Autonumber function works like it does.



Rate this article:   Your rating: Poor Your rating: Not so good Your rating: Average Your rating: Good Your rating: Excellent

Have your say - comment on this article.

What did you think of 'Using AutoNumbers properly'?

No comments yet.

Why not be the first to comment on this article?!

Have your say...

Name
E-mail (e-mail address will be kept private)
Comments
Verify Code
Verification Code
Please note: It may take 30 seconds after clicking submit - please be patient to avoid duplicate submissions.   All comments must be approved before being displayed on this web page.  This process may take up to 24 hours.


Site tools

SmartAccess
300+ articles.
Promo code EA-45K2D46TVS