Forms

  • Thread starter Thread starter Froto
  • Start date Start date
F

Froto

Posted this yesterday, but need some clarification. I
have a textbox with the following code.
Nz(DMax("UserID","Elemental Analysis Request Tbl"))+1
What I would like is to have the code provide the
following sequence in the textbox

Jan-00001, Jan-00002, etc.

Jan stands for the month so it would have to change for
the appropriate months also. What code would I Need to
change inorder for this to happen.

Thanks for all the help
 
Posted this yesterday, but need some clarification. I
have a textbox with the following code.
Nz(DMax("UserID","Elemental Analysis Request Tbl"))+1
What I would like is to have the code provide the
following sequence in the textbox

Jan-00001, Jan-00002, etc.

Jan stands for the month so it would have to change for
the appropriate months also. What code would I Need to
change inorder for this to happen.

Thanks for all the help

Again... I don't know if you saw my previous response.

THIS IS A BAD IDEA.

What will you do next January? Is the record "Jan-00001" the record
from January 2004, from January 2005, from January 2003? THIS IS NOT A
UNIQUE ID.

If you insist, use two fields not one: IDMonth and IDNum, text and
long integer. Put textboxes txtIDMonth and txtIDNum on the form bound
to these fields. Change your BeforeInsert event to something like

Me!txtIDMonth = Format(Date(), "mmm")
Me!txtIDNum = Nz(DMax("UserID","Elemental Analysis Request Tbl", _
"[IDMonth] = '" & Format(Date(), "mmm") & "'))+1

You can concatenate the IDMonth and IDNum fields in a query for
display purposes, and use ctrl-mouseclick to select both of them and
make them the Primary Key. Of course, your problems will begin next
January (actually what will happen is that if the last record this
January is "JAN-00312" then the first record next year will be
"Jan-00313").
 
Back
Top