Autonumber in groups of 10

C

ChuckW

Hi,

I want to create an autonumber field but have it go in groups of 10 such as
41770, 41780, 41790 etc rather than one number right after another. It woul
also be fine to create a field that isn't autonumber but automatically goes
up by 10 every time there is a new record created. Can someone help?

Thanks,
 
M

Michel Walsh

With Jet 4, you can specify the starting point and the increment. To be
executed in the Immediate (Debug) window, NOT in the query designer:



CurrentProject.Connection.Execute "CREATE TABLE toto555 ( tutu555
AUTOINCREMENT(1000, 10), titi555 TEXT(50) ) ; "


Hoping it may help,
Vanderghast, Access MVP
 
S

scubadiver

Put the following code in the "before insert" event. "RecordID" is the field
and "tble_hrs" is (obviously) the table!

Me!RecordID = DMax("[RecordID]", "[tble_hrs]") + 1

Hope it helps
 
S

scubadiver

Put the following code in the "before insert" event. "RecordID" is the field
and "tble_hrs" is (obviously) the table!

Me!RecordID = DMax("[RecordID]", "[tble_hrs]") + 10

Make sure you manually enter the appropriate number in the first record
otherwise it won't work.

Hope it helps
 
C

ChuckW

Thanks for your help. I am a novice access user and am trying to figure out
how to do this. I this done through a query? I am used to doing queries in
design mode and sometimes going in and modifying the sql in the sql viewer
code. Can you give me a few steps on where to start with this process?

Thanks,
--
Chuck W


scubadiver said:
Put the following code in the "before insert" event. "RecordID" is the field
and "tble_hrs" is (obviously) the table!

Me!RecordID = DMax("[RecordID]", "[tble_hrs]") + 1

Hope it helps

ChuckW said:
Hi,

I want to create an autonumber field but have it go in groups of 10 such as
41770, 41780, 41790 etc rather than one number right after another. It woul
also be fine to create a field that isn't autonumber but automatically goes
up by 10 every time there is a new record created. Can someone help?

Thanks,
 
S

scubadiver

that should be

Me!FIELDNAME = DMax("[FIELDNAME]", "[TABLENAME]") + 10



ChuckW said:
Thanks for your help. I am a novice access user and am trying to figure out
how to do this. I this done through a query? I am used to doing queries in
design mode and sometimes going in and modifying the sql in the sql viewer
code. Can you give me a few steps on where to start with this process?

Thanks,
--
Chuck W


scubadiver said:
Put the following code in the "before insert" event. "RecordID" is the field
and "tble_hrs" is (obviously) the table!

Me!RecordID = DMax("[RecordID]", "[tble_hrs]") + 1

Hope it helps

ChuckW said:
Hi,

I want to create an autonumber field but have it go in groups of 10 such as
41770, 41780, 41790 etc rather than one number right after another. It woul
also be fine to create a field that isn't autonumber but automatically goes
up by 10 every time there is a new record created. Can someone help?

Thanks,
 
Top