PC Review


Reply
Thread Tools Rate Thread

Create custom autonumber field

 
 
KLR
Guest
Posts: n/a
 
      2nd Aug 2010
Hi everyone

I need to create a custom autonumber field in my table that is
sequential and based on another fields value.

I have a field which shows a dropdown of years. I now need a separate
number field that commences 40001 if the year selected is 2010, 50001
if 2011 is selected, 60001 if 2012 selected and so on. Thus when a
new record is created for 2010, the record numbering will start at
40001 incrementing by 1 each time a new record is created for 2010.

Is this feasible in Access? BTW this is not my chosen method for
numbering records but has been requested by my users and they will not
budge on this!
 
Reply With Quote
 
 
 
 
Jeff Boyce
Guest
Posts: n/a
 
      2nd Aug 2010
Hopefully you (if not your users) are aware that calling it a "custom
autonumber" field doesn't make it equivalent to an Access Autonumber
field...

Provided that the users (who are NOT always right, but are always the users)
get something that looks like what they think they want, how you get there
(behind the curtain) isn't important (to them), right?

Arvin offered one approach.

Another approach would be to add together the current year and 37,990, then
add a sequence number. That sequence number would need to "re-start" at 1
each year, so your routine that generates the "next" sequence number would
need to find the previous maximum sequence number for the year, then add
one. I believe that approach is what Arvin was suggesting.

To get some ideas on how to build your sequence number procedure, search for
"custom autonumber" on-line, and follow the links Arvin provided.

Good luck!

Regards

Jeff Boyce
Microsoft Access MVP

--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.

"KLR" <(E-Mail Removed)> wrote in message
news:4f4b0d75-f0fd-4c17-a577-(E-Mail Removed)...
> Hi everyone
>
> I need to create a custom autonumber field in my table that is
> sequential and based on another fields value.
>
> I have a field which shows a dropdown of years. I now need a separate
> number field that commences 40001 if the year selected is 2010, 50001
> if 2011 is selected, 60001 if 2012 selected and so on. Thus when a
> new record is created for 2010, the record numbering will start at
> 40001 incrementing by 1 each time a new record is created for 2010.
>
> Is this feasible in Access? BTW this is not my chosen method for
> numbering records but has been requested by my users and they will not
> budge on this!



 
Reply With Quote
 
 
 
 
KLR
Guest
Posts: n/a
 
      3rd Aug 2010
On 2 Aug, 17:38, "Jeff Boyce" <nonse...@nonsense.com> wrote:
> Hopefully you (if not your users) are aware that calling it a "custom
> autonumber" field doesn't make it equivalent to an Access Autonumber
> field...
>
> Provided that the users (who are NOT always right, but are always the users)
> get something that looks like what they think they want, how you get there
> (behind the curtain) isn't important (to them), right?
>
> Arvin offered one approach.
>
> Another approach would be to add together the current year and 37,990, then
> add a sequence number. *That sequence number would need to "re-start" at 1
> each year, so your routine that generates the "next" sequence number would
> need to find the previous maximum sequence number for the year, then add
> one. *I believe that approach is what Arvin was suggesting.
>
> To get some ideas on how to build your sequence number procedure, search for
> "custom autonumber" on-line, and follow the links Arvin provided.
>
> Good luck!
>
> Regards
>
> Jeff Boyce
> Microsoft Access MVP
>
> --
> Disclaimer: This author may have received products and services mentioned
> in this post. Mention and/or description of a product or service herein
> does not constitute endorsement thereof.
>
> Any code or pseudocode included in this post is offered "as is", with no
> guarantee as to suitability.
>
> You can thank the FTC of the USA for making this disclaimer
> possible/necessary.
>
> "KLR" <k.robe...@ucas.ac.uk> wrote in message
>
> news:4f4b0d75-f0fd-4c17-a577-(E-Mail Removed)...
>
>
>
> > Hi everyone

>
> > I need to create a custom autonumber field in my table that is
> > sequential and based on another fields value.

>
> > I have a field which shows a dropdown of years. *I now need a separate
> > number field that commences 40001 if the year selected is 2010, 50001
> > if 2011 is selected, 60001 if 2012 selected and so on. *Thus when a
> > new record is created for 2010, the record numbering will start at
> > 40001 incrementing by 1 each time a new record is created for 2010.

>
> > Is this feasible in Access? *BTW this is not my chosen method for
> > numbering records but has been requested by my users and they will not
> > budge on this!- Hide quoted text -

>
> - Show quoted text -


Crumbs, thanks guys! Good suggestions and has given me lots to think
about.
 
Reply With Quote
 
a a r o n . k e m p f @ g m a i l . c o m
Guest
Posts: n/a
 
      4th Aug 2010
SQL Server allows you to build a tsql function and use that for
defaults on fields

-Aaron



On Aug 3, 12:54*am, KLR <k.robe...@ucas.ac.uk> wrote:
> On 2 Aug, 17:38, "Jeff Boyce" <nonse...@nonsense.com> wrote:
>
>
>
> > Hopefully you (if not your users) are aware that calling it a "custom
> > autonumber" field doesn't make it equivalent to an Access Autonumber
> > field...

>
> > Provided that the users (who are NOT always right, but are always the users)
> > get something that looks like what they think they want, how you get there
> > (behind the curtain) isn't important (to them), right?

>
> > Arvin offered one approach.

>
> > Another approach would be to add together the current year and 37,990, then
> > add a sequence number. *That sequence number would need to "re-start"at 1
> > each year, so your routine that generates the "next" sequence number would
> > need to find the previous maximum sequence number for the year, then add
> > one. *I believe that approach is what Arvin was suggesting.

>
> > To get some ideas on how to build your sequence number procedure, search for
> > "custom autonumber" on-line, and follow the links Arvin provided.

>
> > Good luck!

>
> > Regards

>
> > Jeff Boyce
> > Microsoft Access MVP

>
> > --
> > Disclaimer: This author may have received products and services mentioned
> > in this post. Mention and/or description of a product or service herein
> > does not constitute endorsement thereof.

>
> > Any code or pseudocode included in this post is offered "as is", with no
> > guarantee as to suitability.

>
> > You can thank the FTC of the USA for making this disclaimer
> > possible/necessary.

>
> > "KLR" <k.robe...@ucas.ac.uk> wrote in message

>
> >news:4f4b0d75-f0fd-4c17-a577-(E-Mail Removed)....

>
> > > Hi everyone

>
> > > I need to create a custom autonumber field in my table that is
> > > sequential and based on another fields value.

>
> > > I have a field which shows a dropdown of years. *I now need a separate
> > > number field that commences 40001 if the year selected is 2010, 50001
> > > if 2011 is selected, 60001 if 2012 selected and so on. *Thus when a
> > > new record is created for 2010, the record numbering will start at
> > > 40001 incrementing by 1 each time a new record is created for 2010.

>
> > > Is this feasible in Access? *BTW this is not my chosen method for
> > > numbering records but has been requested by my users and they will not
> > > budge on this!- Hide quoted text -

>
> > - Show quoted text -

>
> Crumbs, thanks guys! *Good suggestions and has given me lots to think
> about.


 
Reply With Quote
 
Access Developer
Guest
Posts: n/a
 
      6th Aug 2010
"a a r o n . k e m p f @ g m a i l . c o m" <(E-Mail Removed)> wrote

> SQL Server allows you to build a tsql
> function and use that for
> defaults on fields


True. But, likely not applicable, as most SQL Server users who post here
identify their data store.

Larry





 
Reply With Quote
 
a a r o n . k e m p f @ g m a i l . c o m
Guest
Posts: n/a
 
      12th Aug 2010
you can define the function IN ONE PLACE on the database server..
instead of 1,000 different copies of the same function



On Aug 6, 6:35*pm, "Arvin Meyer" <arv...@invalid.org> wrote:
> As does VBA, VB.NETm and most other languages that can interact with a data
> engine. So what? If you aren't going to answer the OPs question, what's the
> point of answering at all.
> --
> Arvin Meyer, MCP, MVPhttp://www.datastrat.comhttp://www.accessmvp.comhttp://www.mvps.org/access
> Co-author: "Access Solutions", published by Wiley
>
> "a a r o n . k e m p f @ g m a i l . c o m" <aaron.ke...@gmail.com> wrotein
> messagenews:4b03cec7-e050-42dd-a16c-(E-Mail Removed)...
> SQL Server allows you to build a tsql function and use that for
> defaults on fields
>
> -Aaron
>
> On Aug 3, 12:54 am, KLR <k.robe...@ucas.ac.uk> wrote:
>
> > On 2 Aug, 17:38, "Jeff Boyce" <nonse...@nonsense.com> wrote:

>
> > > Hopefully you (if not your users) are aware that calling it a "custom
> > > autonumber" field doesn't make it equivalent to an Access Autonumber
> > > field...

>
> > > Provided that the users (who are NOT always right, but are always the
> > > users)
> > > get something that looks like what they think they want, how you get
> > > there
> > > (behind the curtain) isn't important (to them), right?

>
> > > Arvin offered one approach.

>
> > > Another approach would be to add together the current year and 37,990,
> > > then
> > > add a sequence number. That sequence number would need to "re-start" at
> > > 1
> > > each year, so your routine that generates the "next" sequence number
> > > would
> > > need to find the previous maximum sequence number for the year, then add
> > > one. I believe that approach is what Arvin was suggesting.

>
> > > To get some ideas on how to build your sequence number procedure, search
> > > for
> > > "custom autonumber" on-line, and follow the links Arvin provided.

>
> > > Good luck!

>
> > > Regards

>
> > > Jeff Boyce
> > > Microsoft Access MVP

>
> > > --
> > > Disclaimer: This author may have received products and services
> > > mentioned
> > > in this post. Mention and/or description of a product or service herein
> > > does not constitute endorsement thereof.

>
> > > Any code or pseudocode included in this post is offered "as is", withno
> > > guarantee as to suitability.

>
> > > You can thank the FTC of the USA for making this disclaimer
> > > possible/necessary.

>
> > > "KLR" <k.robe...@ucas.ac.uk> wrote in message

>
> > >news:4f4b0d75-f0fd-4c17-a577-(E-Mail Removed)....

>
> > > > Hi everyone

>
> > > > I need to create a custom autonumber field in my table that is
> > > > sequential and based on another fields value.

>
> > > > I have a field which shows a dropdown of years. I now need a separate
> > > > number field that commences 40001 if the year selected is 2010, 50001
> > > > if 2011 is selected, 60001 if 2012 selected and so on. Thus when a
> > > > new record is created for 2010, the record numbering will start at
> > > > 40001 incrementing by 1 each time a new record is created for 2010.

>
> > > > Is this feasible in Access? BTW this is not my chosen method for
> > > > numbering records but has been requested by my users and they will not
> > > > budge on this!- Hide quoted text -

>
> > > - Show quoted text -

>
> > Crumbs, thanks guys! Good suggestions and has given me lots to think
> > about.


 
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
"autonumber" based on subset of "autonumber" field SteveP. Microsoft Access Form Coding 5 2nd Mar 2010 04:31 PM
Autonumber without a autonumber field PennyB Microsoft Access VBA Modules 3 3rd Jul 2009 05:41 PM
Create a Sub Autonumber that re-assigns autonumber to each data groupin a sorted field. Junwenren Microsoft Access 1 4th Oct 2008 05:30 AM
Adding autonumber to a non autonumber field don Microsoft Access 2 22nd Apr 2008 05:00 PM
AutoNumber field does not contain "(AutoNumber)" when adding a record Keith Microsoft Access Forms 3 12th Nov 2003 05:50 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:00 AM.