Re: creating a an automatically incrementing, formatted reference number

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



You still don't need a command button. If you don'tike the default
LabNumber, just type over it.

On the data entry form, you can put code in the AfterUpdate event of a field
that formats what you just entered to appear the way you want. Note that it
will still be the way you entered it in the table. So in other forms and
reports, you need to use an unbound textbox that formats a value in a hidden
bound field in its control source.

PC Datasheet
Providing Customers A Resource For Help With Access, Excel And Word
Applications
resource@xxxxxxxxxxxxxxx



"coldfire" <emspider0907@xxxxxxxxx> wrote in message
news:1183083926.448067.49160@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
On Jun 28, 9:53 pm, "Steve" <s...@xxxxxxxxxxxxxxxxxxxx> wrote:
You don't need a command button to do this; it can be done automatically!

In the table the form is based on, add a field named MyPrimaryKey and
make
it autonumber and add MyPrimaryKey to your form. On your for, set the
default value of LabNumber to the following expression:
Format(Year(Date()),"YY") & "-" & Format([MyPrimaryKey],"0000")

PC Datasheet
Providing Customers A Resource For Help With Access, Excel And Word
Applications
resou...@xxxxxxxxxxxxxxx

"coldfire" <emspider0...@xxxxxxxxx> wrote in message

news:1183077176.528453.174710@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Hello, I'm new to access so please bare with me. I have created a
database which records information about cases, in this form is a lab
number column that i want to increment to the next unused number, with
the click of a command button on the form. The format that I want to
use for the lab number is 00-0000 the first two digits being the last
two digits of the year, and the other 4 digits incrementing with the
click of this button. I have tried vigorously to write code to do
this, however to no avail. Could someone please help me with this?

Thank you in advance,
coldfire

The reason that I want a button to formulate the new number is so that
i can enter older records into the database via this form, and also so
i can add duplicates with an additional rn number in another field.
Also is there anyway to format the manually input numbers so they show
up in the database how i want, not just make them look that way like
with an input mask.



.



Relevant Pages

  • Re: creating a an automatically incrementing, formatted reference number
    ... LabNumber, just type over it. ... that formats what you just entered to appear the way you want. ... use for the lab number is 00-0000 the first two digits being the last ... i can enter older records into the database via this form, ...
    (microsoft.public.access.modulesdaovba)
  • Re: Great SWT Program
    ... extension you want to give the destination file. ... because they also cover all sorts of formats beyond graphics formats. ... position to set up the relevant command. ...
    (comp.lang.java.programmer)
  • GNU Texinfo 4.8 released (fwd)
    ... I have released version 4.8 of Texinfo, ... Texinfo has a new command @copying to define the ... This change was made in 4.1, but not mentioned in NEWS. ... Docbook output: recognize more image formats. ...
    (comp.os.linux.announce)
  • Re: Downloading NHK news broadcasts
    ... format and can save the various formats (including streamed ... you can't transcode with MPlayer. ... parts of the FFmpeg project - although not quite the same way as i.e. ... pointing out that for those not accustomed to command line programs, ...
    (sci.lang.japan)
  • Re: call system
    ... regardless of which directory is in use on calling the ... !command line formats needed ... create needed command line and execute it (see formats above) ... directory of the shell that the CD command runs in. ...
    (comp.lang.fortran)