BSP Counter Field Reset
=======================

Microsoft Access allows you to define "counter" fields in Access tables.  
These are LongInteger fields, which automatically increment by one with the
addition of each new record.  Many users find these fields useful for auto-
matically assigning a unique ID to a record.  But in many cases it is desired
to start numbering the records at some value other than 1.  There are various
techniques for forcing the "next" value of a table's counter field to be a 
specific value.  However, these techniques are somewhat clumsy.  BSP Counter
Field Reset provides an easy-to-use form to allow the user to select a table, 
specify a new counter value, and reset the counter automatically.

Installing BSP Counter Field Reset
==================================

1)  Copy file BSP_CTR.MDA into the directory where you have Microsoft Access
    2.0 installed.

2)  Start Microsoft Access and open any database.

3)  Select File|Add-ins|Add-in Manager from the menu.

4)  "Counter Field Reset" should appear in the list of available add-ins.  If
    it does, click the "Install" button.  If it doesn't, click the "Add New" 
    button, and select the path and file where you installed the BSP_CTR.MDA
    file.

5)  Click the "Close" button.  Then restart Microsoft Access.


Using BSP Counter Field Reset
=============================

Select File|Add-ins|Counter Reset from the Access menu to start BSP Counter
Field Reset.  Then, follow the steps below:

   Step 1:  Select a table

            A list box on the left side of the form will list all user-defined
            tables that contain a counter field.  To select your table, either
            single-click on the table name and then click the "Select Table"
            button, or double-click on the table name.

            "Select Table" takes you to step 2.
            "Cancel" closes the application.

   Step 2:  There are four text boxes on the left side.  The first text box
            displays the name of the selected table, and the second text box
            displays the name of its counter field.  (Any table can have only
            one counter field.)  The third text box shows you the highest value
            currently assigned to any record;  the fourth text box shows you 
            the next value Access will assign to the counter field in a new
            record.

            These values usually differ by 1.  However, the difference will be 
            GREATER THAN 1 if records were added to the end of the table and 
            then deleted.

            The new value assigned to the counter MUST be greater than the value
            in the fourth text box.  If there is a gap of more than 1, and you 
            wish to "reclaim" the high unused counter values, you MUST close 
            and compact the database.  However, be aware that this will reset 
            ALL "next" counter values in ALL tables in the database.

            "Set Counter" takes you to step 3.
            "Change Table" returns you to step 1.

   Step 3:  The table name and field name remain on the form, but the "current 
            maximum" and "next value" text boxes are replaced by a single text
            box in which you can specify the new value you want used as the 
            "next" counter value.  New records added to the table will begin 
            numbering with the value you specify here.

            "Go!" resets the counter and takes you to step 4.
            "Change Table" returns you to step 1.

   Step 4:  BSP Counter Field Resets reports whether it was successful in re-
            setting the counter value.

            "OK" returns you to step 1 to select another table.
            "Cancel" closes the application.


Additional Notes
================

In order to reset the counter value, BSP Counter Field Reset must insert and then
delete a record in the selected table.  This has several implications.  First, you 
must have ReadDesign and Update rights for the table.  Second, the presence of
table validation rules, field validation rules, required fields, default values,
and/or unique indexes can cause the reset process to fail.

For example, suppose a field is defined as Required and has a Unique Index.  BSP
Counter Field Reset must make an arbitrary choice for a value to insert in this 
field.  It allows Jet to use the Default Value if one is specified;  otherwise it
uses "X" for text/memo fields, 0 for numeric fields, and Date() for date fields.
However, if one of these values (whether a Default Value or one selected by the
program) duplicates an existing value in the table, the Unique Index will cause
the insert to fail, and the counter will not be able to be reset.  Similarly, the
presence of validation rules can cause an assigned field value to be rejected, and
thus cause the reset to fail.

If this occurs, try to at least temporarily remove "Required" attributes on fields,
validation rules, or unique indexes, while you perform the counter reset.  You can
restore these properties after the reset has been completed.  As a last resort, you
can try altering the program code to provide acceptable values.

There is an apparent bug regarding attached tables -- the "Required" property of
fields always APPEARS to be "No" even if it is actually set to "Yes".  As a result,
Counter Field Reset does not recognize that it needs to provide a value for the
field.  If the field does not have a Default Value set, then you will not be able
to update the counter value.


Black Sheep Productions
Compuserve ID 74503,2251

(Special thanks to Tad Orman, Microsoft PSS, for assistance rendered)