automatic consecutive numbers

N

NQBoomer

I need a field in my table to automaticly insert consecutive invoice numbers
starting 1275 every time a new record is added. I have tried to decipher the
Northwind sample, as it has that feature, but have been unsucsessful.
any help would be greatly appreciated
 
T

Tim Ferguson

I know there is a process for setting the start number for an
AutoNumber field . . . but I don't know what it is.

INSERT INTO MyTable (MyAutonumber)
VALUES (1275 -1);

The minus one is strictly unneccessary, but it reminds you that you need to
insert the last missing number, not the first one you want.

Mind you, remember that "if you care about the value of an Autonumber
field, then you probably should not be using an autonumber."

HTH


Tim F
 
T

Tim Ferguson

Butyou are dealing with an incredible newbe

Don't worry: we've all been there!
I assume you meant with MyTable that it is the table I created,
and with My autonumber that it is an autonumber field i have to
insert.

Yes to both
in doing so, I cannot find where to set the value.

The easiest way, frankly, is to type it straight into the SQL window. When
it is this short, it's easier than wangling it into the grid window. Start
a new query in Design View, close the Add Table window and then select
View..SQL View. Delete the little bit that is there and type in the
command, just as I put before, but using your tablename and fieldname.

INSERT INTO MyTable (MyAutonumberField)
VALUES (1274);

Then click the red Exclamation mark (!) to run it. If you get an error
message about Key Violation it's because there is already a 1274 record in
the table. Any other error is probably a typing error: post information
back here if you need to.

Best of luck

Tim F
 

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