Access newbie to see: Number generation problem

zhaozj2021-02-16  54

Access newbie to see: Number generation problem

Brief description: Explain the definition method of the actual life in a chat record and misunderstandings

problem:

I tell you about what I am here. It seems that the work number is 03-0756-004-1jf, indicating: 03 indicates that the production of 03 years is 0756 is a contract number, 004 represents the number of the other unit, and 1 means of the contract, JF is a label. Will you say that will this work number will be annoying?

Reply:

I can only say that you have been wrong when you design the data structure. Many programmers think "numbered" is a field. This is indeed correct, however, in the computer, the number is not meaningful, no syntax, no combination, no meaning, only the unique identifier recorded. In actual production, the number often contains many significance (unless you use the database query system to manage random numbers). So just as you said, each part of the number has a meaning. Therefore, the database structure should be established in each part as a minimum unit. Simply put, the production date, the contract number, the other party number, the workshop is divided into several fields, which can also be said to be "atomic" extension. In fact, SQL can not only query data, but also organize data, such as

SELECT Date & Contract Number & Unit & Workshop AS Number, Full Name from Product Table

problem:

But very miserable: The entrant has been used to entry 03-0456-002-4jf, told them to separate, I am afraid it is troublesome.

Reply:

You can write some code segmentation data on the save button, even if the continuous form can write code in the BeforeUpdate event. Code can be similar:

SPLITSTRING () AS STRING Stra () = Split (Me.TextBoxa, "-") DIM I AS Integer for i = 0 to Ubound (Stra) Debug.Print Stra (i) ME ("TextBox" & i) .Value = stra (i) Nextend SUB

http://access911.net webmaster collection

转载请注明原文地址:https://www.9cbs.com/read-24492.html

New Post(0)