Re: Create and store unique record number.
- From: "Mike Painter" <mddotpainter@xxxxxxxxxxxxx>
- Date: Mon, 25 Apr 2005 01:22:28 GMT
Erik S. via AccessMonster.com wrote:
> I've been searching through the threads trying to find a post that
> matches my question but I can't seem to locate one. I need to have
> the form automatically generate a unique number in a specific format,
> and I need that number to be stored in the database so it would be
> searchable. What I'm trying to do is generate a number that is based
> upon the year, month, then a 3 digit number on the end such as
> 05.04.001 for 2005, April, 001. I also need this number to change
> based upon the month and year. I have field for the record number to
> be displayed at the top of the form and I'd like for this number to
> show in that field. In my data table I have 2 fields that I can use
> to generate this number. RecordID field and RecordDate field. I just
> don't know how to get it to generate and display the number. I tried
> using some previous post suggestions to figure this out, but I either
> get compiler errors or it simply doesn't work. Please, if anyone can
> help I would greatly appreciate it.
>
You don't say where the date comes from nor do you say how the 3 digit
number changes based on month and year.
You can just store the date and format it (yy.mm) to give the value you
want.
If the number starts over based on some value then you will need a table to
store the number. Retrieval, updating and resetting would be done in code.
It would be better to have to fields and use a calculated field to display
them
= YourFormattedDateField & "."& YourNumberField.
This approach usually costs a client extra and after a year or two they say
"You know, you were right. We really don't need and hardly ever use that
number anymore now that we have a computer."
.
- References:
- Create and store unique record number.
- From: Erik S. via AccessMonster.com
- Create and store unique record number.
- Prev by Date: Re: Create and store unique record number.
- Next by Date: Code for Opening Filtered Form
- Previous by thread: Re: Create and store unique record number.
- Next by thread: RE: Create and store unique record number.
- Index(es):
Relevant Pages
|