Serial No with date

naobao

Registered User.
Local time
Today, 05:32
Joined
Feb 13, 2014
Messages
99
Hi,


How to auto add a Serial No with date in a form field, like the following sample format...
N201911190001
N201911190002
N201911190003
N201911190004
N201911200001
N201911200002
N201911200003
N201911210001
N201911210002
the last four digital can reset everyday


Thank !!
 
Hi. The usual approach is to keep the components of the serial no separate. For example, there should be at least a date field and a numeric field. You can compare the value in the date field to the current date, and you can also calculate the last number in sequence from the number field.
 
Can you give me some sample code?
 
Can you give me some sample code?
Sure. Let's say you have a separate date field and a numeric field for the sequence number. To get the next number in sequence, you could try something like:
Code:
Nz(DMax("NumberFieldName","TableName","Format(DateFieldName,'yyyymm')=Format(Date(),'yyyymm')"),0)+1
 

Attachments

  • 1.png
    1.png
    12.5 KB · Views: 125
  • 2.png
    2.png
    9.7 KB · Views: 129
Your SerialNo field is text. Change it to Number
 
Hi,


I use your code in a query, but it seem not work...
Hi. For what you're showing us, try the following expression instead:

Code:
test: Nz(DMax("serialno","TblData","dd=#" & Format([dd],"yyyy-mm-dd") & "#"),0)+1
 
Hi. For what you're showing us, try the following expression instead:

Code:
test: Nz(DMax("serialno","TblData","dd=#" & Format([dd],"yyyy-mm-dd") & "#"),0)+1
Left hand side is the query result,
but I need right hand side result...
 

Attachments

  • 111.png
    111.png
    15.9 KB · Views: 118

Users who are viewing this thread

Back
Top Bottom