Re: creating a an automatically incrementing, formatted reference number
- From: "Steve" <sorry@xxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 29 Jun 2007 02:53:41 GMT
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.
.
- References:
- Prev by Date: Re: WordLink and making GUI's
- Next by Date: Re: Macro limit? creating overflow
- Previous by thread: Re: creating a an automatically incrementing, formatted reference number
- Next by thread: Re: WordLink and making GUI's
- Index(es):
Relevant Pages
|