B
BillA
I read an old thread from Allen Browne who replied to a question of
incrementing number using the year and sequential number.
This is the suggestion Allen provided on 8/18/2006 (subject: Incremental
number):
_____________
You will need to use a fixed width number at the end, say 3 digits like
this: VD2006001, VD2006002, ...
Dim varMax as Variant
DocID = "VD" & Year(Date)
varMax = DMax("DocID", "Table1", "DocID Like """ & DocID & "*""")
varMax = Val(Nz(Mid(varMax, 7), 0)) + 1
DocID =DocID & Format(varMax, "000")
--
Allen Browne - Microsoft MVP.
_______________
I would like to use this code to satisfy a need to increment a currently
filled (manually) field which uses the year and sequential number, i.e.
2007001; 2007002, etc... (I don't need the addional "VD")
Can someone explain where this code is placed. In the module for the table
holding the field I will use, in my case tbl_Project.ProjectID? I haven't
been able to get this to work for me.
Any advice would be appreciated.
Thanks,
Bill
incrementing number using the year and sequential number.
This is the suggestion Allen provided on 8/18/2006 (subject: Incremental
number):
_____________
You will need to use a fixed width number at the end, say 3 digits like
this: VD2006001, VD2006002, ...
Dim varMax as Variant
DocID = "VD" & Year(Date)
varMax = DMax("DocID", "Table1", "DocID Like """ & DocID & "*""")
varMax = Val(Nz(Mid(varMax, 7), 0)) + 1
DocID =DocID & Format(varMax, "000")
--
Allen Browne - Microsoft MVP.
_______________
I would like to use this code to satisfy a need to increment a currently
filled (manually) field which uses the year and sequential number, i.e.
2007001; 2007002, etc... (I don't need the addional "VD")
Can someone explain where this code is placed. In the module for the table
holding the field I will use, in my case tbl_Project.ProjectID? I haven't
been able to get this to work for me.
Any advice would be appreciated.
Thanks,
Bill