Connecting Tech Pros Worldwide Help | Site Map

Automatic Tracking Number

pjac
Guest
 
Posts: n/a
#1: Nov 12 '05
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
WindAndWaves
Guest
 
Posts: n/a
#2: Nov 12 '05

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


Larry Daugherty
Guest
 
Posts: n/a
#3: Nov 12 '05

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]



pjac
Guest
 
Posts: n/a
#4: Nov 12 '05

re: Automatic Tracking Number


BOT
Larry Daugherty
Guest
 
Posts: n/a
#5: Nov 12 '05

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]


Closed Thread


Similar Microsoft Access / VBA bytes