PC Review


Reply
Thread Tools Rate Thread

AutoNumber field reset to 1 at year end

 
 
=?Utf-8?B?cnVzczcwNDY=?=
Guest
Posts: n/a
 
      21st Feb 2005
I have inherited an access database that is designed to work as a tech
workorder system. IE unscheduled and scheduled workorders are generated and
then stored in a master WorkT table. Each time a new workorder is generated,
the WorkID field is incremented by 1. This all works well, but I would like
to reset that number to 1 at the beginning of a new year. That way I can
quickly see by max number how many workorders have been created for a
particular site/year. I have looked at the default table / query settings,
but can't find a way to modify the autonumber function.
Any help would be appreciated
 
Reply With Quote
 
 
 
 
Jeff Boyce
Guest
Posts: n/a
 
      21st Feb 2005
If you scan the tablesdbdesign newsgroup, you find a strong consensus
against using the Autonumber data type for anything other than what it was
designed to do, provide a unique row identifier to facilitate setting
relationships between rows in tables.

It sounds like your application is using an Autonumber type to stand in for
a sequence number. The dead give-away is that you want it to "reset" at
point in time.

Consider keeping the autonumber as a unique row identifier, but adding a new
"SequenceNumber" field. You can find (via Google.com and/or at the
mvps.org/access website) references to "custom autonumber" routines that
will generate sequential numbers. The gist of the routines is to find the
largest sequence number so far, add one, and assign that to the new record.
If you need to, you can (slightly) alter the routine to first check for the
year (or any other 'break point'), and re-start the numbering.

--
Good luck

Jeff Boyce
<Access MVP>

"russ7046" <(E-Mail Removed)> wrote in message
news:EEB8A60F-821D-4B94-B354-(E-Mail Removed)...
> I have inherited an access database that is designed to work as a tech
> workorder system. IE unscheduled and scheduled workorders are generated

and
> then stored in a master WorkT table. Each time a new workorder is

generated,
> the WorkID field is incremented by 1. This all works well, but I would

like
> to reset that number to 1 at the beginning of a new year. That way I can
> quickly see by max number how many workorders have been created for a
> particular site/year. I have looked at the default table / query settings,
> but can't find a way to modify the autonumber function.
> Any help would be appreciated


 
Reply With Quote
 
=?Utf-8?B?cnVzczcwNDY=?=
Guest
Posts: n/a
 
      21st Feb 2005


"Jeff Boyce" wrote:

> If you scan the tablesdbdesign newsgroup, you find a strong consensus
> against using the Autonumber data type for anything other than what it was
> designed to do, provide a unique row identifier to facilitate setting
> relationships between rows in tables.
>
> It sounds like your application is using an Autonumber type to stand in for
> a sequence number. The dead give-away is that you want it to "reset" at
> point in time.
>
> Consider keeping the autonumber as a unique row identifier, but adding a new
> "SequenceNumber" field. You can find (via Google.com and/or at the
> mvps.org/access website) references to "custom autonumber" routines that
> will generate sequential numbers. The gist of the routines is to find the
> largest sequence number so far, add one, and assign that to the new record.
> If you need to, you can (slightly) alter the routine to first check for the
> year (or any other 'break point'), and re-start the numbering.
>
> --
> Good luck
>
> Jeff Boyce
> <Access MVP>
>
> "russ7046" <(E-Mail Removed)> wrote in message
> news:EEB8A60F-821D-4B94-B354-(E-Mail Removed)...
> > I have inherited an access database that is designed to work as a tech
> > workorder system. IE unscheduled and scheduled workorders are generated

> and
> > then stored in a master WorkT table. Each time a new workorder is

> generated,
> > the WorkID field is incremented by 1. This all works well, but I would

> like
> > to reset that number to 1 at the beginning of a new year. That way I can
> > quickly see by max number how many workorders have been created for a
> > particular site/year. I have looked at the default table / query settings,
> > but can't find a way to modify the autonumber function.
> > Any help would be appreciated

>
> thanks for the info, I will see what I can find

 
Reply With Quote
 
David C. Holley
Guest
Posts: n/a
 
      22nd Feb 2005
If the site information and date/time that the workorder is created is
stored in the DB, why not just run a query on the table? It'll save a
lot of time. And BTW you can use a function as an output field of a
query to extract the year in which a WO was opened.

russ7046 wrote:
> I have inherited an access database that is designed to work as a tech
> workorder system. IE unscheduled and scheduled workorders are generated and
> then stored in a master WorkT table. Each time a new workorder is generated,
> the WorkID field is incremented by 1. This all works well, but I would like
> to reset that number to 1 at the beginning of a new year. That way I can
> quickly see by max number how many workorders have been created for a
> particular site/year. I have looked at the default table / query settings,
> but can't find a way to modify the autonumber function.
> Any help would be appreciated

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
reset autonumber every year automatically =?Utf-8?B?QmlqYWlLdW1hcg==?= Microsoft Access 1 19th Sep 2006 06:29 PM
How to reset the autonumber field? =?Utf-8?B?TWlncw==?= Microsoft Access 3 28th Jan 2005 10:13 AM
AutoNumber Field Reset =?Utf-8?B?QkNQ?= Microsoft Access 2 12th Oct 2004 06:06 PM
reset autonumber field kim Microsoft Access Database Table Design 4 6th Jan 2004 05:57 PM
reset autonumber field. Kim Microsoft Access Database Table Design 1 5th Jan 2004 11:46 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:49 PM.