automatic consecutive numbers

  • Thread starter Thread starter NQBoomer
  • Start date Start date
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
 
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
 
Tim

Thank youfor your input.
Butyou are dealing with an incredible newbe
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.
in doing so, I cannot find where to set the value.
the only value discription i can find, only allows random or
increment. Could you please elaborate a little more.
Where exactly do I set the value of the starting number?

also sorry about the email address change, AOL locked up,
and i could not mark the thread unread before it did, and i lost the
header.
Thankyou in advance
Jeff V
 
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
 
Back
Top