How do I increment table entry a specified # of times? 01,02,03

9

92Superglide

I am creating a serial number table. User will enter prefix, I need to make
a table entry incremented by 1 for a specified number of entries.

Example:

791456-01
791456-02
791456-03

User inputs "791456"
 
A

a a r o n . k e m p f

use a calculated column, that's what I'd reccomend.

with SQL 2005; you can have calc columns 'persist' the data.

in other words
a) keep a simple identity key (autonumber-- some people call it)
b) append customerNumber '791456-' to the prefix (store the 791456 in
another coulmn, and calculate the dash, or should I say concatenate)

jet doesn't support computed columns.. I think that it's the biggest
shortcoming in JET, personally
 
K

KARL DEWEY

Create a table named CountNumber with field named CountNUM containing number
from 0 (zero) through your maximum spread.
INSERT INTO YourTable ( SN )
SELECT [Enter Starting Serial #]+[CountNUM] AS Expr1
FROM CountNumber
WHERE (((CountNumber.CountNUM)<=[Enter qunaity of records]-1));

Reference the textboxes on the form instead of [Enter Starting Serial #]
and [Enter qunaity of records] to enter data from form.
 

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