Open Library - an open library of educational information. Modes of working with MS Access objects Basic objects ms access purpose

The main objects of ACCESS are: tables, queries, forms, reports, macros, and modules.

Table - ϶ᴛᴏ an object that is defined and used to store data. Each table includes information about an object of a certain type. A table contains fields (columns) and records (rows). You can work with a table in two basic modes: Design view and Datasheet view.

Design view sets the table structure, ᴛ.ᴇ. types, properties of fields, their number and names (column headers) are defined. It is used if you need to change the structure of the table, not the data stored in it.

Datasheet view is used to view, add, modify, sort or delete data in a simple way.

Query - ϶ᴛᴏ object that allows the user to get the desired data from one or more tables. Query - ϶ᴛᴏ question that the user asks ACCESS about the information stored in the database.

Queries can be created independently and with the help of wizards. In ACCESS, you can create the following types of requests:

Sample request;

Request with parameters;

cross request;

Change request (request for deleting, updating and adding records to create a table);

Union requests, server requests, control requests, sub-requests.

With the help of queries, you can view, analyze and change data from several tables, create new tables. Οʜᴎ are used as a data source for forms and reports.

You can work with queries in two basic modes: Design view and Datasheet view.

Form - ϶ᴛᴏ object, mainly intended for convenient input of data display. Unlike tables, forms do not contain database information. Form - ϶ᴛᴏ format (form) for displaying data on a computer screen. Forms can only be built from tables or queries. Building forms based on queries allows you to present information from several tables in them.

Drawings, diagrams, audio (sound) and video (image) can be embedded in the form.

Modes of work with the form:

Form mode is used for viewing and editing data, provides an environment for working with data and convenient design of their presentation on the screen;

Form Design Mode is required if it is critical to change the definition of a form (structure or form template) rather than the data it represents;

Table view allows you to see a table that includes all form fields;

Report - ϶ᴛᴏ an object designed to create a document ͵ which can later be printed or included in a document of another application. Reports, like forms, can be generated from queries and tables, but do not allow data entry.

Report modes:

- preview mode allows you to see the report as it will be printed;

- constructor mode is designed to change the template (report structure).

Macro - ϶ᴛᴏ object, which is a structured description of one or more actions that ACCESS should perform in response to a specific event.

For example, you can define a macro that, in response to selecting an item in the main form, opens another form. With the help of another macro, you can check the value of a certain field when its content changes. You can include additional conditions in a macro for the execution or non-execution of certain actions included in it.

Working with forms and reports is greatly facilitated by using macros. MS ACCESS has over 40 macros that can be included in macros. Macros perform actions such as opening tables and forms, executing queries, running other macros, selecting options from menus, and so on. Macro commands allow you to perform a set of actions that you often have to perform during work by pressing one (or several) buttons.

A module is an object containing programs in MS ACCESS BASIC that allow you to break the process into smaller steps and detect those errors that could not be found using macros.


  • - Practical work 3.1. MS Access. creating tables using the wizard

    Laboratory work 3.graphic capabilities of a spreadsheet processor Calculation of the amount of payments for interest on a loan. TOTAL PAYMENT function The TOTAL PAYMENT function returns the amount of accumulated income on a loan, which is repaid in equal installments every... [read more]


  • - Technology of making calls and calls in Ms Access

    Power control How to create a data base? With what objects does the data base work? What is a table? How to set the power of fields? What is a key field? How to change the table structure? What is a form? How do I create forms data base? What are the modes of fermentation? Yak ... [read more]


  • - Technology for creating rich tabular databases in Ms Access

    Meta: get a thorough knowledge of the basics of danich. Consider designing rich table data bases. Learn about the technology of creating a table and linking between data of different tables. Familiarize yourself with the technology of molding and forming on the basis of linked tables. Theoretical ... [read more]


  • - Analysis of economic tasks, analysis of data and forecasting of economic indicators in MS Excel and in MS Access

    Mova structuring queries SQL. SQL development – ​​zapitіv Creation of a database and a robot from a database in a Microsoft Access DBMS Create a database with a database in MS Excel Create a relational database in MS Excel 5.2.1. Pobudov's relational database in MS Excel


  • - The cob of work with MS Access

    After launching MS Access, a working screen of the MS Access programs will appear on the screen, at the top row of which the Main Menu is expanded, and below it is the toolbar. There are buttons that duplicate the commands of the main menu. (For the additional command View ® Toolbars ® Settings. ..

  • Window and DBMS objects Microsoft Access

    Window DBMS Microsoft Access

    There are two sections in the database window (a vertical row of buttons on the left - see the figure):

    Chapter Objects : a vertical row of buttons represents all objects that can be created in the database: tables, queries, forms, report you, macros, modules.

    Chapter groups, where custom object groups are created, designed to store references to objects of various types. Initially in the section Groups there is only one group From abusive.

    Window working field


    Clicking on the selected object displays in window working field modes creating an object (in our example - 3 modes of creating tables), as well as a list of previously created objects of the selected type (in our example, they are absent; if they are, they are located here).

    Objects of different types can be combined into groups. Groups allow you to combine objects of the same topic in large databases. To add objects to a group, the context menu of the required object is called (by right-clicking on its icon), the command is selected D add to group and in it the group in which the object is included (if necessary, you can immediately create a new group). The following figure shows an example. Objects are represented in a group by labels referring to the object included in the group.


    Objects DBMS Microsoft Access

    DBMSMicrosoft Access allows you to create the following objects:

    tables , designed to store information about one separate object from a given subject area. Every table in a relational database must have unique (primary) key, which can be simple or compound. By means of primary keys between tables are created connections to share data from separate tables.

    Forms to enter, correct and view information in a user-friendly way. With the help of forms, you can impose restrictions on access to data, control input data, receive calculated data, and display messages. It is possible to handle events that occur while working with the form. You can create a form based on any table or query.

    Requests allow you to select the required data from one or more related tables using a user-defined condition, perform calculations and get the result in the form of a table. In this case, database tables can be used, as well as saved tables obtained as a result of executing other queries. A query can be built directly on another query using its temporary results table.

    Reports for the formation of output documents containing the necessary results, and their printing. The basis for creating a report can be a table, a query.

    Macros to record a sequence of macros (actions) that are executed when some event occurs in an object or control. A macro is recorded once and executed many times, it is used to perform frequently repeated operations to increase work efficiency (remember the macros from MicrosoftWord).

    Modules are standard - individual database objects. Designed to group related procedures (instructions written in the programming language VisualBasicfor applications that perform the necessary operations and calculations). Only procedures contained in a module can be executed. It is not possible to request the execution of a module as a whole. The procedures of these modules are available from any other database objects. These procedures can be called from other standard module procedures, event procedures, macros, or simply from expressions.

    Form and Report Modules to store procedures related to handling events in a form or report (clicking on a form or report element, double-clicking, receiving focus by an element, etc.), as well as ordinary procedures for common actions.

    Access is focused on working with objects, which include database tables, queries, as well as application objects for working with the database: forms, reports, pages, macros and modules.

    For typical data processing processes - viewing, updating, searching by specified criteria, receiving reports - Access has tools for designing forms, queries, reports, and pages. Application objects are made up of graphical elements called controls. The main controls are used to link objects with records of tables that are data sources.

    When creating user applications, programming tools are also used that are implemented by objects of a different type - macros and modules in the VisualBasicforApplications (VBA) programming language.

    The objects are represented in the Access database window. All operations on working with database and application objects begin in this window.

    tables(Tables) are created by the user to store data about one information object of the domain data model. A table consists of fields (columns) and records (rows). Each field contains one characteristic of the subject area object. The record collects information about a single instance of this object.

    Requests(Queries) are created by the user to select the necessary data from one or more related tables. The result of the query execution is a table that can be used along with other database tables when processing data. A query can be formed in the form of query by pattern (QBE) or using an SQL statement - Structured Query Language. You can also use a query to update, delete, or add data to a table, or create new tables based on existing ones.

    Forms(Forms) are the main means of creating a dialog interface of a user application. The form can be created to enter and view related database data on the screen in a convenient way that corresponds to the user's familiar document. Forms can also be used to create control panels in an application.

    Reports(Reports) are designed to generate output documents containing the results of solving user problems and print them.

    Pages Data access pages (Pages) are interactive Web pages that maintain a dynamic connection to the database and allow you to view, edit, and enter data into the database while working in a browser window.

    Macros(macros). A macro is a program that contains a description of a sequence of actions to be performed when an event occurs in an application object or control. Each action is implemented by a macro. Creating macros is carried out in a dialog mode by selecting the necessary macros and setting the parameters used by them during execution.

    Modules(Modules) contain procedures in the VBA language. Function procedures can be created that are developed by the user to implement non-standard functions in the user application, and procedures for handling events. In Access, for the convenience of the user, database objects can be combined into groups according to functional or other criteria. Groups contain links to database objects of various types.

    In the Access database window, along with the list of created objects, there are shortcuts (shortcuts) that are designed to quickly launch wizards or the constructor for creating a new object.

    All database tables, as well as other Access objects: forms, queries, reports, macros and modules built for this database, and embedded objects can be placed on disk in a single format file. mdb. This simplifies the database maintenance technology and user application. Provides high compactness of placement of all database objects on disk and efficiency of data processing. Access data access pages are stored in separate files, only links to them are placed in the database file.

    The Access package is included in the extended (professional) delivery of the MS Office package and is more difficult to use compared to the Word and Excel packages.

    The purpose of MS Access is to create and use Database.

    Database - a set of logically related information about some area of ​​human activity; the database consists of one or more interconnected tables; one Access database is contained in a special file with the extension . mdb (example database file: Employees.mdb).

    Database Management System (DBMS) - a set of programs that implement all the necessary operations with databases (creation, filling, storage, processing, output).

    Table - kit records of the same type (for example, a set of information about the organization's suppliers); tables are the basis of a modern database; each table must have a name that is unique in the database.

    Recording - kit fields, describing the structure of the information stored in the table (for example, what information about suppliers should be stored in the table); fields in the same record must be logically related to each other.

    Field - an elementary logically indivisible unit of information in the database (examples of fields: supplier's name, contact information, etc.); each field must have a unique name and type; the field type depends on the type of information stored in it; the main types of fields are: numeric, text (text up to 255 characters), counter (integer numbers in order), MEMO field (large arbitrary text), date/time, currency, OLE object field (any image); some fields in the table have special uses and are called key.

    Key field (key) - a special field that determines the uniqueness of each record in this table; the key can be any field or group of fields, as long as they have a unique set of values ​​for each record in the table; in most cases, uniqueness is ensured by introducing a special field into the record - a serial number or, when records (type-counter); when deleting or adding records to the table, the uniqueness of the values ​​of these fields is tracked automatically; key fields have other uses, such as sorting data in order and linking tables to each other.

    The simplest database consists of one table. To store data about the organization's suppliers, you can create the following simple table named "suppliers" (Table 1):

    Table 1

    Most real databases consist of several related tables. The need to use several tables is explained by the fact that each table, if possible, should not contain records in which there is a lot of duplicate data. On the one hand, this reduces the amount of stored information, and on the other hand, it eliminates the redundancy of information in tables and significantly increases the efficiency of using the database.

    Partitioning all the information stored in the information database into separate tables is quite complex and requires certain knowledge and experience. The basis of such a partition is a special mathematical apparatus of relational algebra.

    There are special software systems that, based on the analysis of the data being processed, allow you to find the best database structure. If two database tables are related, then most often the type of this relationship is defined as "One to many", i.e. one record in one (master) table corresponds to several records in another (subordinate) table.

    Tables are linked using key fields: the subordinate table, in addition to its main key, contains a field whose name and type usually matches the key field of the main table. Such a field is called a foreign key.

    Working with an Access package requires two main steps:

    · Database creation;

    · Use of a database for information processing.

    In turn, the creation of a database begins with the creation of a new database file *. mdb and can be run like this:

    · Complete "manual" description of the database structure as a set of tables, records and fields;

    · Based on the available blanks - database templates (there are 22 in total), from which you can select the necessary tables and fields.

    The description of each table includes:

    · Setting the table name;

    · Determination of the key field (usually this is the counter-code field), which is set in the first place in the list of fields;

    · Enumeration of all other fields included in the table, indicating their name and types.

    After describing the tables, it is necessary to establish a relationship between them using foreign keys. For this, a special visual tool is used, launched by clicking the "Data Schema" button on the toolbar. It allows you to select linked tables and use the mouse to "stretch" the link between the fields of the tables with the same name.

    After that, you can begin the most uninteresting, but necessary stage - filling in the created database with information. For this, special objects are usually created - forms. Their purpose is to enter and further edit those stored in the database. A form is a set of input fields corresponding to the fields of a particular table. The easiest way to create a form for a specific table is automatically using the "New Object/AutoForm" button. Each firm is assigned a name under which it is stored in the database file and can be used later.

    The use of the created and filled database is based on two more basic concepts - a query and a report. The query allows you to perform the necessary actions with the stored data.

    There are the following types of requests:

    · On data sampling;

    · To add records;

    · To delete and edit records.

    The most commonly used queries are for data sampling. Queries are generated using a special constructor that allows you to specify the tables and fields used in the query and set the data selection conditions. Created queries are stored in a database file and can be used multiple times. Based on any existing query, you can build a new one by changing the set of fields and selection conditions.

    LESSON #1

    Topic. The concept of databases and database management systems (DBMS). Characteristics of MS Access DBMS. Data types and field properties.

    Database (DB) is a systematized repository of information of a specific subject area, which can be accessed by various users to solve their problems. Subject area the part of the real system that is of interest for this study is called.

    The main purpose of the database is to quickly search for the information contained in them.

    Databases are factual and documentaries. Factual databases contain short information about objects, submitted in a well-defined format (for example, Author, title, year of publication). Documentary databases contain information of various types: textual, sound, graphic, multimedia. For example, a database of modern music may contain lyrics and notes of songs, photographs of authors, sound recordings, video clips.

    The database itself contains only information and cannot serve user requests for searching and processing information. The database is maintained by the database management system.

    Database management system (DBMS)- this is software that allows you to create a database, update the information stored in it and provide convenient access to it for viewing and searching.

    DBMS requirements:

    Ability to manipulate data;

    Ability to search and generate queries;

    Ensuring the integrity (consistency) of data;

    Security and secrecy.

    The main features of the DBMS:

    Updating, replenishment and expansion of the database;

    High reliability of information storage;

    Conclusion of complete and reliable information on requests;

    Means of protecting information in the database.

    There are such DBMS as Microsoft Access, FoxPro, Paradox, Oracle, Sybase, dBase. The most popular DBMS is Access, which is a simple but powerful tool for processing and storing data.

    Main objects of MS ACCESS DBMS

    An object Description
    tables Contains data in the form of a two-dimensional table. Tables are the basis of the database; all other objects depend on them.
    Requests Created to search and select data from a table that meets certain conditions. Queries also allow you to update or delete multiple records at the same time, perform inline or custom calculations.
    Forms Used to view, enter, or modify data in tables. The form also allows you to select data from one or more tables and display it on the screen using a standard or user-created layout.
    Reports Display in a certain way and print data from a table or query. The data in the report is not editable.
    Pages They are a special type of Web pages designed to work with a database through a local or global network.
    Macros Special commands for automating work with the database.
    Modules VBA programs to perform more complex operations that macros cannot perform.


    DB entry- this is a table row, a specific implementation (value) of the concept of the subject area.

    DB field is a column in the data table, a property (attribute) of a given concept of the subject area.

    DB key field– a field that uniquely identifies (identifies) a record. For example, an employee's personnel number, product code, vehicle number.

    For each field, set data type , which may be in it:

    text– can contain a character string up to 255 characters long;

    memo field– a text field used to enter large texts consisting of several lines (up to 65,535 characters);

    numerical– number of any type (integer, real, etc.). Property - size (byte, integer, long integer, floating point, number of decimal places);

    date Time– contains a date and time in the range from 100 to 9999;

    monetary - applies to currency values. Prevents rounding when performing calculations. Can have up to 15 integer digits and up to 4 fractional digits;

    counter - provides automatic insertion of sequential (increasing by 1) or random numbers when an entry is added. It is guaranteed that the counter values ​​will not be repeated;



    logical - contains only one of two values: "Yes/No", "True/False", "On/Off";

    OLE object field − contains pictures, sound files, Excel spreadsheets, Word document, etc. To display an OLE object on a form or report, you must use an attached object frame;

    substitution master - this mode is not a standalone type. Selecting it launches a wizard that allows you to create a list or assign a table or query from which you can select values ​​for the field. The data type is set according to the values ​​selected during the wizard.


    All field types (except counter) have the following properties :

    field size– sets the maximum number of characters to enter in this field. For a text field, this is the maximum number of characters (up to 255). When choosing a size, keep in mind that in a 20-character field, you won't be able to enter text that's 30 characters long. On the other hand, setting the length too large can cause the database file to grow unnecessarily if the values ​​stored in the field are significantly less than its set length. For numeric fields, the size is selected from a list of possible numeric data types;

    new values ​​- determines how the counter value changes when new records are added;

    field format - determines how the contents of the field should be displayed, for example, for the Date / Time type, you can select the date representation of the form June 30, 1999 or 6/30/99;

    number of decimal places defines the number of digits after the decimal point for fractional numbers. This value only affects how numeric values ​​are represented, not how they are stored in memory. ;

    input mask - allows you to set a template for input, which gives some guarantee of the correctness of data entry, it is used for fields of the Date / Time type and text. The input mask displays placeholder characters, shows how many characters to enter, includes separator characters (hyphens, brackets). For example, for a date, the input mask might look like this: --.--.--. This mask is encoded with the 99/99/00 character set. Placeholder 9 means that only digits are allowed, and its entry is optional, placeholder 0 requires a mandatory entry of a digit. When you select the Input Mask property, a button appears on the right that launches a wizard to help you create the mask. For example, a student code is formed from a two-digit faculty number, a three-digit student number, and the last 2 digits of the year of admission: 00-000-"01";0; #."01" - the value in quotes is added to the field automatically; 0 – mask characters are stored in the table along with the entered characters (otherwise 1); # - indicates which character should be in place of the entered characters. When entering data, the user will see the following mask: ## ### ––01;

    signature used as a column heading in datasheet view;

    default value allows you to automatically enter any value in the field;

    value condition- defines the area or range of the value of the data entered in the field;

    error message– allows you to specify the text of the message displayed on the screen if the entered data violates the value condition;

    Obligatory field– has two meanings Yes and No. If set to Yes, Access will require the mandatory entry of a value in this field.;

    empty lines– determines whether empty strings can be entered in this field;

    indexed field– determines whether or not indexing will be carried out for this field. Indexing consists of creating a list of record numbers ordered according to the field values. Having an index speeds up search and sort operations, but requires additional disk space.

    The main database objects that Access allows you to work with are:

    tables;

    requests;

    Data access pages;

    macros;

    To create these objects and edit them, there are special design tools. Each object has its own properties, defining which you can customize it.

    tables are the main data store in the database.

    Requests are created by the user to select the necessary data from one or more related tables according to the condition specified in it. You can also update, delete, or add data to tables with a query, and you can also create new tables.

    Forms designed to enter, view and edit related data on the display screen in a user-friendly way. The form can also be printed.

    Reports are used to generate an output document intended for printing. The report can be previewed on the screen.

    Macro is a description of the actions to be performed in response to some event. Each action is implemented by a macro. With the help of macros, you can perform actions such as opening a form, table or report, exiting Access, etc.

    Modules contain programs in the Visual Basic language that are developed by the user to implement non-standard data processing procedures.

    Pages Data access pages are a special type of Web pages designed to be viewed and operated over the Internet or an intranet with data stored in Microsoft Access databases or Microsoft SQL Server databases. The data access page can also include data from other sources such as Microsoft Excel.

    Tables.

    Table structure.

    Tables form the basis of an Access database - they store all the data. Tables must be carefully planned. First of all, the structure of each table must be planned. The structure of the tables is determined by the content of those output forms and reports that must then be received. When planning tables, it is necessary to avoid duplication of information in different tables.

    The structure of the table is determined by the list of fields, for each of which the following is specified:

    Field name;

    data type;

    List of properties;

    Description.

    The field name must be unique, the maximum length of the name is 64 characters, any characters can be used in the name except """, ".", ",", "!", "[", "]". The name must not start with a space.

    The data type determines the kind and range of valid values ​​that can be entered in the field, as well as the amount of memory allocated for this field.

    A table can contain the following 9 types of fields:

    - Text. Short text. Text and numbers, such as names and addresses, phone numbers, and postal codes. The text field can contain up to 255 characters.

    Field memo. Long text and numbers, such as comments and explanations. A memo field can contain up to 64,000 characters.

    - Numerical. A general type for numeric data that can be used for mathematical calculations, except for calculations for monetary values. The Field Size property allows you to specify different types of numeric data. Length - 8 bytes.

    - Date Time. Date and time values. The user has the option to select one of the many standard formats or create a custom format. Length - 8 bytes.

    - Monetary. Monetary values. Numbers are represented with two decimal places. It is not recommended to use values ​​belonging to the numeric data type for monetary calculations, since the latter can be rounded off during calculations. Currency values ​​are always output with the specified number of decimal places after the decimal point. Length - 8 bytes.

    - Counter. Automatically inserted consecutive numbers. The counter is incremented by one for each subsequent entry. The numbering starts from 1. The counter field is useful for creating a key. There can only be one such field in a table. Length - 4 bytes.

    - Logical. Values ​​"Yes"/"No", "True"/"False", "On"/"Off", i.e. one of two possible values. Length - 1 byte.

    - OLE object field. Objects created in other programs that support the OLE protocol, such as graphics, drawings, and so on. Objects are linked or embedded in a Microsoft Access database through a control on a form or report.

    - Hyperlink. A string of letters and numbers that represents the address of the hyperlink. A hyperlink address can consist of a maximum of three parts: text (text displayed in a field or control); address (path to the file or page), additional address (offset within the file or page). A hyperlink can contain up to 2048 characters.

    Each field of the table corresponds to a set of properties, with the help of which the user determines the type and functional characteristics of the field. The set of properties for a particular field is determined by the data type of that field.

    The field properties depend on the selected data type. The most important are the following properties:

    - field size sets the maximum size of data stored in the field;

    - field format defines the format for displaying data in this field of the table, for example, for a numeric field it can be basic, monetary, fixed-point, exponential, percentage, etc.;

    - number of decimal places sets the number of decimal places for the numeric and monetary data types (can be from 0 to 15);

    - input mask specifies an input mask that facilitates entering data into a control - a field. For example, it is convenient to create the following input mask for the "Phone" field, which allows you to enter only numbers and automatically adds intermediate characters: (___) ___-____.

    - signature sets the text that is displayed in tables, forms and reports to designate (mark) the field, if the label is not set, then the name of the field is displayed;

    - default value allows you to specify a value that is automatically entered in the field when a new record is created. For example, in the "Addresses" table, it may be convenient to automatically enter the value "Moscow" in the "City" field. When filling out the table, users will be able to leave the default value in this field or, if necessary, specify a different city.

    - value condition allows you to exercise input control, defines the requirements for data entered into a record, field or control element;

    - error message allows you to specify the text of the message displayed on the screen if the entered data violates the condition defined in the "Value Condition" property;

    - Obligatory field specifies whether the field requires a value to be entered. If this property is set to Yes, then when you enter a new record, you must enter a value in this field or in any control attached to it. Empty values ​​are not allowed in this field. For example, you might want the Last Name control to display a last name for each record;

    - indexed field defines an index created on a single field. An index speeds up queries that use indexed fields and sorting and grouping operations. For example, if you search frequently on the Last Name field in the Employees table, you should create an index on that field.

    The description is a brief comment that is optional. A comment, for example, can be used to remind the database developer of the reasons for choosing the type and properties of a field.

    Table indexing

    Indexing allows you to speed up sorting and searching for data in a table. You can index numeric, currency, text, logical fields, as well as fields of type Counter and date. You should not create too many indexes on one table, because this will slow down the input and editing of her data.

    An indexed field can contain both unique and duplicate values. For example, in the table Employees you can create an index on a field EmployeeCode, which contains unique code values, or by field Surname A that can contain duplicate values.

    Cannot create indexes for fields MEMO, hyperlinks and OLE objects.

    You can create an arbitrary number of indexes. Indexes are created when the table layout is saved and are automatically updated as records are entered and changed. The user can add new or delete unnecessary indexes at any time in table design mode.

    Index is an internal service table containing two columns. The first column contains the values ​​of the indexed field, the second - the addresses of records that have this value. Indexes allow you to quickly search for a row with a given index field value.

    The key fields of the table are indexed automatically.

    Create a table

    There are five ways to create a new table:

    one). In table mode: data is entered in table mode in rows and columns. Field names are defined by default FIELD1, FIELD2 etc. Access determines the field type and field length based on the entered values. The structure of the table is formed in accordance with the entered values ​​and can then be modified.

    2). In design mode: Here, the table structure is first created, and then the table is populated with data.

    3). In Table Wizard mode: Create a table based on existing templates from the Database Wizard.

    4). In Table Import Wizard mode: Create a table based on data imported from an external source.

    5). In Table Link Wizard mode. This wizard allows you to create a new table not by importing data from an external source, but by linking to external data from a new table.

    The table creation mode is selected in the window Database at the push of a button Create.

    Creating a table structure is a multi-step process:

    Definition of field names, their types and descriptions;

    Defining field properties;

    Key field definition.

    It is desirable that each table has a key field. Key uniquely identifies each entry in the table; Duplicate key values ​​are not allowed. Only tables that have key fields can be linked.

    To define the key, as a rule, one field is selected, and the "Key" button with the image of the key (the Access logo) is pressed on the toolbar. However, in a situation where the data of one field cannot be unique for each record, two or more fields can be designated as key fields.

    The key fields of the table are indexed automatically. If none of the fields is defined as a key when creating a table, then Access prompts you to create a field Counter A that contains the table's unique record number.

    8.6.4. Establish relationships between tables.

    To perform simultaneous data sampling from several tables, they should be linked to each other. You can only link tables that contain fields with the same values. The names of these fields may not match, but data types, field lengths, and most importantly, values ​​must match. The link is established on the data schema. The data scheme is built in accordance with the information-logical data model. When building a data schema, Access automatically determines the type of relationship between tables based on the selected field. Creating a data schema simplifies the design of multi-table forms, queries, and reports, and ensures the integrity of related data.

    Access allows you to establish links of the following types:

    One-to-one communication, in which one record from the first table corresponds to only one record from the second. Such a relationship is established for tables that could be combined into one, but separated in order to speed up the work.

    One-to-Many Relationship used to link one record from the first table to multiple records from the second table.

    Many-to-one communication indicates that multiple records in one table are related to a single record in another table.

    Access allows you to establish not only relationships between tables, but also rules that determine the conditions for interaction between tables and maintain data integrity.

    One of the linked tables is the base table, and the other is the slave table.

    When creating a table relationship, the need to maintain data integrity is determined. If it is necessary to maintain the integrity of the data, then Access requires a strict correspondence between the base and subordinate records (that is, there can be no orphan records). When creating a link, it is possible not to impose a data integrity condition, then the base structure can contain basic records without subordinates and vice versa (i.e. records are “orphans”).

    Access creates specific types of relationships based on the values ​​of the associated field in the underlying table. If the associated field in the underlying table is not indexed, then Access cannot determine the nature of the relationship, and the relationship is described as "not defined".

    If the associated field of the base table is indexed, then the type of relationship is determined according to the following rules:

    If the associated field of the sub-table contains only unique values, then there is a one-to-one relationship;

    If a subtable contains duplicate values ​​in a related field, then a one-to-many relationship exists.

    The data schema is displayed in the window Data Schema, in which tables are represented by lists of fields, and links are lines between fields (see figure)

    To bring up a window Data Schema you can run the command SERVICE/Data Schema and click on the corresponding toolbar button.

    You can add a table to the data schema by right-clicking and selecting the item from the context menu Add table by executing the command LINK/Add Table or by clicking on the button with the same name on the toolbar Connection.

    In the window Data Schema individual tables can be hidden and displayed.

    To establish a relationship between tables, drag the field of the base table to the field of the child table. In the window that appears Connections click the button Create.

    For the connection to be established, parameters must be set.

    In the window Connections you can change the link if it was set incorrectly by selecting the required fields in the lists of fields of the linked tables.

    Normally, you should enable data integrity support using the checkbox Ensuring Data Integrity. If such a setting is made, then the parameters become available. Cascading Update Related Fields and Cascading Deletion of Related Fields.

    If the key field in the primary table is an inter-table relationship field, then the specified options must be selected for all relationships.

    If support for data integrity is enabled in the established connection, then the line of type 1 - ∞ is shown in the diagram as bolder.

    Liked the article? Share with friends: