Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old November 12th, 2005, 11:40 PM
pjac
Guest
 
Posts: n/a
Default Automatic Tracking Number

I need assistance in creating an Automatic tracking number that
appears in a textbox that looks like: 2004-001. The first part of the
number is based on the year, the second part is generated from the
last available number used. Also, the second part of the number needs
to start over whenever a new year is started. for example: 2005-001.
Any help would be greatly appreciated.

Thanks,
pjac
  #2  
Old November 12th, 2005, 11:42 PM
WindAndWaves
Guest
 
Posts: n/a
Default Re: Automatic Tracking Number

try for the controlsource of the control:

=format(datepart(date(), "yyyy"), "0000") & format([id], "000")

or something along those lines

"pjac" <pjac@erols.com> wrote in message
news:9435ccd8.0405100428.2f378782@posting.google.c om...[color=blue]
> I need assistance in creating an Automatic tracking number that
> appears in a textbox that looks like: 2004-001. The first part of the
> number is based on the year, the second part is generated from the
> last available number used. Also, the second part of the number needs
> to start over whenever a new year is started. for example: 2005-001.
> Any help would be greatly appreciated.
>
> Thanks,
> pjac[/color]


---
Please immediately let us know (by phone or return email) if (a) this email
contains a virus
(b) you are not the intended recipient
(c) you consider this email to be spam.
We have done our utmost to make sure that
none of the above are applicable. THANK YOU
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.679 / Virus Database: 441 - Release Date: 07/05/2004


  #3  
Old November 12th, 2005, 11:42 PM
Larry Daugherty
Guest
 
Posts: n/a
Default Re: Automatic Tracking Number

pjac,

The posted formatting ideas may be useful but your question requires a lot
more of an answer.

I often have a table, tblAppVariables for containing values that change over
various times and situations. I put a variable name and then the variable
argument into the table so that I can search the table for the named
variable and get the current value of arument. For example: field VarName:
MyYear might contain "2004" and field VarArg: MyYearlySequence might contain
"123". Do not make this table available or even visible to your users!

You need to write vba code to test the current year against MyYear. When
the year part of Now() is greater then you store the new value in MyYear and
store "000" (or what ever your first number for the year is) in
MyYearlySequence. In your application there should be only one place that
would use the code so the code logically belongs there. If it might be
called from more than one place then put it into a function procedure and
call the function where ever you need it.

HTH
--
-Larry-
--

"WindAndWaves" <access@ngaru.com> wrote in message
news:B3Znc.3274$XI4.124581@news.xtra.co.nz...[color=blue]
> try for the controlsource of the control:
>
> =format(datepart(date(), "yyyy"), "0000") & format([id], "000")
>
> or something along those lines
>
> "pjac" <pjac@erols.com> wrote in message
> news:9435ccd8.0405100428.2f378782@posting.google.c om...[color=green]
> > I need assistance in creating an Automatic tracking number that
> > appears in a textbox that looks like: 2004-001. The first part of the
> > number is based on the year, the second part is generated from the
> > last available number used. Also, the second part of the number needs
> > to start over whenever a new year is started. for example: 2005-001.
> > Any help would be greatly appreciated.
> >
> > Thanks,
> > pjac[/color]
>
>
> ---
> Please immediately let us know (by phone or return email) if (a) this[/color]
email[color=blue]
> contains a virus
> (b) you are not the intended recipient
> (c) you consider this email to be spam.
> We have done our utmost to make sure that
> none of the above are applicable. THANK YOU
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.679 / Virus Database: 441 - Release Date: 07/05/2004
>
>[/color]



  #4  
Old November 12th, 2005, 11:42 PM
pjac
Guest
 
Posts: n/a
Default Re: Automatic Tracking Number

BOT
  #5  
Old November 12th, 2005, 11:43 PM
Larry Daugherty
Guest
 
Posts: n/a
Default Re: Automatic Tracking Number

Oops!

I left out the sequence number bit. You probably have figured it out
already but in cases where the year now is the same as the year saved then
you will retrieve the current sequence number, increment it, save it to a
variable and store the new value back in the table. Then concatenate your
formatted year-sequence and use it as needed.

HTH
--
-Larry-
--

"Larry Daugherty" <Larry.NoSpam.Daugherty@verizon.net> wrote in message
news:Jb7oc.114386$G_.29809@nwrddc02.gnilink.net...[color=blue]
> pjac,
>
> The posted formatting ideas may be useful but your question requires a lot
> more of an answer.
>
> I often have a table, tblAppVariables for containing values that change[/color]
over[color=blue]
> various times and situations. I put a variable name and then the variable
> argument into the table so that I can search the table for the named
> variable and get the current value of arument. For example: field[/color]
VarName:[color=blue]
> MyYear might contain "2004" and field VarArg: MyYearlySequence might[/color]
contain[color=blue]
> "123". Do not make this table available or even visible to your users!
>
> You need to write vba code to test the current year against MyYear. When
> the year part of Now() is greater then you store the new value in MyYear[/color]
and[color=blue]
> store "000" (or what ever your first number for the year is) in
> MyYearlySequence. In your application there should be only one place that
> would use the code so the code logically belongs there. If it might be
> called from more than one place then put it into a function procedure and
> call the function where ever you need it.
>
> HTH
> --
> -Larry-
> --
>
> "WindAndWaves" <access@ngaru.com> wrote in message
> news:B3Znc.3274$XI4.124581@news.xtra.co.nz...[color=green]
> > try for the controlsource of the control:
> >
> > =format(datepart(date(), "yyyy"), "0000") & format([id], "000")
> >
> > or something along those lines
> >
> > "pjac" <pjac@erols.com> wrote in message
> > news:9435ccd8.0405100428.2f378782@posting.google.c om...[color=darkred]
> > > I need assistance in creating an Automatic tracking number that
> > > appears in a textbox that looks like: 2004-001. The first part of the
> > > number is based on the year, the second part is generated from the
> > > last available number used. Also, the second part of the number needs
> > > to start over whenever a new year is started. for example: 2005-001.
> > > Any help would be greatly appreciated.
> > >
> > > Thanks,
> > > pjac[/color]
> >
> >
> > ---
> > Please immediately let us know (by phone or return email) if (a) this[/color]
> email[color=green]
> > contains a virus
> > (b) you are not the intended recipient
> > (c) you consider this email to be spam.
> > We have done our utmost to make sure that
> > none of the above are applicable. THANK YOU
> > Checked by AVG anti-virus system (http://www.grisoft.com).
> > Version: 6.0.679 / Virus Database: 441 - Release Date: 07/05/2004
> >
> >[/color]
>
>
>[/color]


 

Bookmarks

Thread Tools

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 Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles