access| Serial Number | problem
How do I implement automatic numbering in "default value" with code? Document flow number generation problem.
Brief introduction: The issue of document serial number generation
Problem:
How do I implement automatic numbering in "default value" with code? Document flow number generation problem.
How do I implement automatic numbering in "default value" with code?
If I wanted to implement different types of AutoNumber, how would I set up the code?
such as: 1th, number 2nd 、...........、 198th ...........
Or: Cn0001-a, cn0002-b, Cn0003-b 、.........、 cn0004-a, Cn1998-b ...
is the default value of the input code, or where, please advise, thank you!
Reply:
These requirements do not need to be completed in the field properties of the table, which are generally addressed in the interface programming.
Number by using the DCount () or DMAX () function to use a string combination method
Private Sub Field1_enter ()
If IsNull (Field1.value) Then
Field1.value = "CN" & Format (CLng (DMax ("Mid (field1,3,4)", "table1") + 1), "0000") & "-A"
End If
End Sub
Of course, after you know the principle, you have to change the table's "Default value" method to achieve also may not, but personally feel unnecessary.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.