Database applications that use a lookup table. For example, you might have a table with the records with the state. The value in this field must come from the United States StateAbbrev in a lookup table. This program will take time and create a table such as the State concerned.
Enter the name of the database tables and data (that is, the state), lookup tables and fields (State, StateAbbrev), and the relationship that should be tied to the table. (Leave blank if you do not want to build a relationship).
When you click the button. 'The program is open to the database. It removed any relationships, indexes and tables to find out if it was built in the earlier stage.
Next, the code will create a new lookup table and add a field to search. It uses the same data type and size of the field in the table. (Addresses.State).
The field has a lookup table of values should be unique. (It does not make sense to have two records with the "Colorado" in the United States), the program adds a unique index to the search field. (States.StateAbbrev).
This program uses the INSERT INTO statement to copy the values remain the same field. (Addresses.State) to the search field. (States.StateAbbrev) Notice of the [] brackets are necessary only if your name is a reserved word in Access, for example, if you set a table. This is not good practice, and it is better to avoid those keywords. If you are willing to do that, then remove all the brackets and the program will crash if you accidentally use the wrong name.
If you enter a name associated with the many-to-one relationship between the two fields. This relationship allows one to find the field to match the records in the table. That makes sense because a lot of records that are subject to the same state.
If you did not create this relationship, your code can continue to use a lookup table. The list of state permits. The database does not enforce the limit for you....
No comments:
Post a Comment