Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

AutoNumber Question for a form... 1

Status
Not open for further replies.

stlrain95

Programmer
Sep 21, 2001
224
0
0
US
Can you manipulate the Auto Number so that you can start off with whatever number you want and then count from there after??

I.E. 101....102,103,etc?

Instead of 1,2,3,4,etc?
 
I have read that there is a way to do this, but I do not know what it is.

In some cases, I have just changed the autonumber to an integer, did any changes I needed manually, and then changed it back.
 
I get around this by the following clumsy means:

Don't do anything to the autonumber field.
Put a textbox control on your form, set the data source to:
=100 + [AutoNumberField]
or whatever will give you the desired result
Have a second field to hold this new number, which updates on an appropriate event:
me![Field2] = Me![Text1]

Not a particularly elegant solution, but it at leat avoids messing around with your autonumbers, which, from everything I've read or seen in these forums, is unwise.

Cheers
Chris
 
Access has an article in the help document to solve this problem. Search for help on: "Changing the starting value of an Autonumber field". Or read below where I pasted it:
---------------------------------------

For a new table that contains no records, you can change the starting value of an AutoNumber field whose NewValues property is set to Increment to a number other than 1. For a table that contains records, you can also use this procedure to change the next value assigned in an AutoNumber field to a new number.

1. If your original table contains property settings that prevent Null values in fields, you must temporarily change those properties. These settings include:
* The Required field property set to Yes
* The Indexed field property set to Yes (No Duplicates)
* A field and/or record ValidationRule property that prevents Null values in fields

2. Create a temporary table with just one field: a Number field. Set its FieldSize property to Long Integer and give it the same name as the AutoNumber field in the table whose value you want to change.

3. In Datasheet view, enter a value in the Number field of the temporary table that is one (1) less than the starting value you want for the AutoNumber field. For example, if you want the AutoNumber field to start at 100, enter 99 in the Number field.

4. Create and run an append query to append the temporary table to the table whose AutoNumber value you want to change.

5. Delete the temporary table.

6. Delete the record added by the append query.

7. If you had to disable property settings in step 1, return them to their original settings.


***When you enter a record in the remaining table, Microsoft Access uses an AutoNumber field value one (1) greater than the value you entered in the temporary table.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top