Re: Create and store unique record number.



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."




.



Relevant Pages

  • Create and store unique record number.
    ... I've been searching through the threads trying to find a post that ... RecordID field and RecordDate field. ... generate and display the number. ... but I either get compiler errors or it ...
    (microsoft.public.access.forms)
  • Re: Can I mimic a btn_Click() ?
    ... In the sample code instead of searching an event with type of ... Other remote UDP command are> OK as long as the display is not affected. ... Once I'm in the> CalibrateLCD_Clickevent handler my sender and "this" look OK in my> "Autos" window in both cases. ...
    (microsoft.public.dotnet.framework.compactframework)
  • For readers
    ... I keep searching for the perfect gadget to take ... Around a 6" x 9" display ... The purpose of the operating is *mainly* to retrieve (from ... I know there have been some ebook-type reader marketing failures, ...
    (microsoft.public.pocketpc)
  • Re: Create a button to save/update record OR add new record
    ... automatic in ms-access anyway). ... So, you need some caution if you are use the SAME form for searching, as any ... ' invoice exist...lets display the invoice form ... invoice form to ONE record,then you can hide/disable the record navigation ...
    (microsoft.public.access.forms)
  • Re: how to deal with multiple result sets in D6 ADO?
    ... >> Thanks, but after further studying, I find I need more info. Can you ... I've been searching the ... Or do you need to extract data and stuff it into a TStrinGrid ... >> if you want to display it? ...
    (borland.public.delphi.database.ado)