Using data of type OLE Object Field (OLE Object). Text fields of arbitrary length Data type ole object field

OLE input

The field of an OLE object called Foto can be populated even without the object (image) itself being displayed on the screen. The following objects can be stored in an OLE type field.

Raster images.

Sound files

Graphs and (diagrams)

Word or Excel

in a way that they can be seen, heard or used. When you place an OLE object in a table, you will see text describing the object (for example, in the OLE type field, you can see the inscription Paintbrush Picture). There are two ways to enter an object.

Paste from clipboard

Insert from the dialog box that appears after executing the command Insert->Object (Insert->Object)

Entering MEMO data

The Review field contains data of type MEMO. This type allows you to enter up to 64000 bytes of text for each entry. The table displays only part of the entered text. pressing , you can display an input dialog (Zoom) with a scroll bar that allows you to see up to 1,000 bytes of text at once

Move through records in a table

As a rule, after entering the data, it often becomes necessary to make some changes. This may be due to the following reasons

New information received

Errors found

Need to add new entries

To change the data, first open the table In the database window, open the table in datasheet mode by double-clicking on the line with its name in the list of tables. AAAAAAAAAAAAAAAAAAAAAAAAAAA

If you are in Table Design mode, click the Views button to switch to Table View to make changes to the data.

Move through records

To go to any record, you can simply place the cursor on it or click on it with the mouse. But if the tables are very large, then the problem of quickly moving to the desired record becomes especially acute

You can use the vertical scroll bar to navigate through the records. The arrow buttons on the scroll bar allow you to move the record marker only one position per click. Therefore, for faster movement (through several records at once), it is better to use the scroll bar slider. You can also click the mouse in the area between the slider and the button on the scroll bar to move to many positions ahead.

The Edit->Go command provides several options for quickly moving around the table.

The five navigation buttons at the bottom of the table view window can also be used to move through the records By clicking on these buttons, you can jump to any record If you know the record number (line number for a given record), click in the record number field, enter entry number and press the key To move to the entry number field, press the key .

As you move through the table, pay attention to the scroll bar hints. Access does not update the record number field until you click in any of the record fields.

Setpoint search

Although knowing the record number, you can navigate to it and look for a specific field, in most cases you will need to find a specific value in the record. This can be done in three ways:

Select command Edit->Find (Edrt->Find)

Click on the Find Specified Text button located on the toolbar (it shows binoculars).

Use keyboard shortcut

When using any of these methods, a dialog box will appear. To search only for a specific field, place the cursor in it (and do this before opening the dialog box). Select the Search Only Current Field check box in the dialog box and Access will only search the specified field.

This dialog box allows you to set various search options. Enter the value you are looking for in the Find What text box You can enter the value as it appears in the box, or by using the following special characters:

* -- Matches any number of characters

Matches one character

# -- Matches one digit

To understand how these characters work, suppose you want to find all values ​​that start with AB To do this, enter AB*

Now, suppose you want to find values ​​that end in 001. In this case, enter *001. To search for any value that starts with AB, ends with 001, and contains only two characters between them, type AB??001. If you need to find all surnames ending in “ko”, then to search for values ​​like Brodsky and Tchaikovsky, enter *ko.

The Match drop-down list contains three options:

With any part of the field (Any Part of Field)

Whole Field

From the beginning of the field (Start of Field)

The standard option is Whole Field. For example, the value Pet will be found if the value is Pet. If the Any Part of Field option is selected, then the search results will retrieve the values ​​Petrov, Petrovsky. Shpetny, etc. As a result of the search with the setting From the beginning of the field (Start of O), the values ​​​​of Petrov, Petrovsky will be found.

In the drop-down list View (Search) you can select one or more options from the set All, Up, Down (Up, Down, All)

If you select the Search Only Current Field option button, only one field will be searched for a value. The Match Case check box determines whether uppercase and lowercase letters are distinguished. They are the same by default. Searching for Pet will find Pet, Petr, and Petrov. If you select the Match Case check box, you must enter a search string that takes into account uppercase and lowercase letters

Clearly, case-sensitivity doesn't make sense for Number, Currency, and Date/Time data types.) When you select the Match Case check box, Access ignores the Match Case check box. Fields As Formatted) (If you formatted the fields of the table, check this box) For example, you need to search in the Date of Birth field for records of everyone born in April 1982. To do this, select the Search Fields as Formatted option and enter Apr 92. If you do not check this box, you will have to search by the exact date of birth, for example, look for 4/8/92

Using the Search Fields as Formatted checkbox can significantly slow down the search.

The search will begin when you click the Find First or Find Next button. When Access finds a value, it highlights it To find the first matching value, click the Find button. To search for the next value, click the Find Next button. The dialog box remains open throughout the search process. Therefore, when you find the value you want, click the Close button to close the dialog box.

Boolean fields

Boolean fields are used to store data that can take one of two possible values. The Boolean Field Format property allows you to use custom formats or one of three built-in formats: True/False, Yes/No, or On/Off. In this case, the values ​​True, Yes, and On are equivalent to the logical value True, and the values ​​False, No, and Off are equivalent to the logical value False.

If you select the built-in format and then enter an equivalent boolean value, the entered value will be displayed in the selected format. For example, if a True or On value is entered into a Field control that has a Yes/No in the Field Format property, the entered value is immediately converted to Yes.

When creating a custom format, remove the current value from the Format property and enter your own format.

Text fields arbitrary length

Free-length text fields (MEMO fields) can contain the same data types as plain text fields. The difference between these fields is that the length of MEMO type fields can be very large compared to the size of text fields. May contain long text or a combination of text and numbers.

OLE object fields

MS Access allows tables to store images and other binary data (e.g. MS Excel spreadsheet, MS Word document, sound recording drawing) linked or embedded in a table Microsoft Access. For this purpose, the data type Field of the OLE object is used. The actual amount of data you can enter in the field of this type, is determined by the volume hard drive Your computer (up to 1 Gigabyte).

Lookup master data type

Selecting this data type launches a lookup wizard that creates a field that offers a choice of values ​​from a drop-down list containing a set of constant values ​​or values ​​from another table. Selecting this option from the list in a cell launches a lookup wizard that determines the field type.

Boolean format

Money format

Numeric format

Text format

Data types

The size of the text field can range from 1 to 255 characters.

The type of a numeric field can take values ​​from the following list:

byte- integers ranging from 0 to 4255;

whole- integers from - 32768 to 32767;

long integer - integers from - 2147483648 to 2147483647;

floating point (4 bytes)- numbers ranging from - 3.402823E38 to 3.402823E38;

floating point (8 bytes) - numbers ranging from minus 1.79769313486232E308 to plus 1.79769313486232E308.

Date/Time Format

For data type Date Time There is a set of field formats shown below along with examples:

Full format (set by default) 04/15/94 05:30:10 PM

Short date format 04/15/94

Long time format 17:30:10

Medium Time Format 05:30 PM

Short time format 17:30

By default, the currency format represents numbers written with two decimal places, with separation of groups of digits and the notation "R." in the end. The user can write in a line Field Format template for your format. Let's say you want to enter dollar amounts. Then you need to place the cursor on the word Monetary and replace it with a format pattern like this: # ###$ .

Format "counter"

Fields of the "counter" type perform a specific function - automatic identification of table records. Therefore, there are few properties that could be changed for such a field. First, the counter is always a number. Secondly, its value is incremented automatically. Access offers two options for changing the counter: consistent And random. The first option is convenient because it allows you to number the records. The second option can be used if you need to create a system for encoding records in a table that is protected from careless actions of the operator.

A cell in a boolean field can only contain one of two values: Yes or No. Access offers two more options for boolean type names: True/False And Enabled/Disabled. Regardless of which field format you choose, a logical field will be represented in the table as a set of checkboxes. When you click on a checkbox with the mouse, it causes a checkmark image to appear in the square, which corresponds to a boolean value Yes. Resetting a checkbox means assigning a boolean value to a cell No. The use of logical fields can be different, for example, in questionnaires or to create controls.

OLE object field(Object Linking and Embedding) - the last field type selected from the list. It has only two properties: a caption and a "required field" parameter. Fields of this type do not store information as such, but contain references to objects that can be included in the database using the OLE data exchange protocol. Such objects can be, for example, graphic files.



In order to embed an OLE object into a field cell, you need to place the cursor on it and, by pressing the right mouse button, call the context menu. In it, select the command Insert object. The program will open a dialog box to select the object type. The object in this case is identified with the application in which it can be created or edited.

The second option for inserting an object - selecting a radio button Create from file in the window Inserting an object. IN In this case, it is assumed that the file already exists, and you need to link to it. Access will open a window for opening a document, and after selecting the desired file, it will determine which application must be opened to work with it.

Access 2010 has the ability to add objects to a field with OLE data type. When the data type is given as OLE (Object Linking and Embedding)- linking and embedding an object), then the Access DBMS saves the external an object in a common database file, allocating as much space for its storage as this object takes up as a separate file. Under objects should be understood as files created as applications in graphic editors, video clips, in MS Office applications, etc. When filling a table with data that are objects, a message is generated in the corresponding position of the field with the OLE data type about the program with which you can open this object. Object Display will be carried out only in forms and reports.

For object embedding in the field with OLE data type you need to open the table in constructor mode. Add a new field like "Product photo". Select data type "OLE Object Field" and then save the table.

Then in table view in the line for data entry, right-click, in the menu that opens, select the line with the command, which will open a dialog box (Fig. 3.38, Fig. 3.39).

Rice. 3.38 Inserting an object

Rice. 3.39 Dialog box for adding a new object to an Access table

Keep in mind that there are two possibilities to embed objects as data. The first possibility involves the use of standard applications for creating a file that Access supports, the second possibility of inserting an object, which allows you to use any file as a data source (Fig. 3.40).

Rice. 3.40 Adding a new object to an Access table from a file

1. Creating an object from a file.

When it comes to data that is objects to the database and is external files, it is required to have those files. Therefore, you will need to create several files in order to see their display in the database in the future, and also try to modify these files. For example, if you have a photo of an object in the file Monitor.jpg(jpg - universal photo format). In order for this file to be saved in the database, you should check the box (Fig. 3.40) "Create from file", after which a window will appear, which is shown in Figure 3.41. With button "Overview" select the required file.

Rice. 3.41 Finding a file when creating an object in the database

In the corresponding line for the field for example, "Product photo" the word will appear "Package" (Package), this means that the file is tied to the application with which it was created. Therefore, when browsing the database, whether it is a query, a form or a report, the user will see the image of the file as an icon, and when double-clicking on this image, the system will first find the application, and then display the contents of the file in it (in this example, this is a photo) . The exception is image files saved with the extension .bmp(bit map format). However, it should be recalled that files created in Microsoft applications, will be displayed immediately in forms and reports. The output is simple, photos can be inserted into applications such as Paint, Word, Power Point, saved as separate files, and then connected as an object to the database. Try creating multiple photo and text files using different Windows editors. For example, you can open a Word document, paste a photo from the file, add text, and then save as: Monitor.docx(Fig. 3.42).

Rice. 3.42 Photo file created in Word

2. Creation of new objects.

By creating new objects in the database, you should mean using an application in which the file is created and then connected in a field describing the type of this OLE. To start the mode of creating new objects, you need to open the table in table mode, select an option "Create new" in the dialog box (Fig. 3.39), and then in the list select "Object type"(required application). The list of applications that Access supports to create an object are in the list (Fig. 3.43), which will open after running the command "Insert Object" .

Rice. 3.43 List of Access object types that can be used to create files

The convenience of using applications to create objects in the form of files lies in the fact that in the future these files can be used independently or their correction can be carried out in the database.

Consider object creation option for the database, with paint applications.

For example, you need to create an object with an image of the company and text that the database user can later replace or correct. To do this, select from the list Bitmap Image object, further technology for creating an object is shown in Figure 3.44.

1. Open the Paint app

2. Insert a photo from a file.

3. Add text (if necessary).

4. Save as a file.

5. Close the application.

Rice. 3.44 Technology for creating an object in the Paint application

The task 3.11

1. In the table " Goods» in mode "Constructor" add a new column named "Product photo", data type " OLE object field", save your changes.

2. In mode "Table" in field "Product photo" select line "Insert object from file", select (dot) "Create new" and select from the dropdown list document Microsoft Word . This will open text editor MS Word, here you need to insert a picture corresponding to the product in this line. Choose pictures from the list that is stored directly in the editor (Insert tab, Picture icon, Start button in the dialog box on the right), or insert a picture from other programs. You can use the Paint application (Bitmap Image object) where you draw the product yourself. Close the created file, it will automatically be attached to your database, to the line in which it was inserted.

3. Follow this procedure to all lines your tables "Products".

4. Save your changes.

test questions

1. What objects can be inserted into a database with an OLE data type?

2. How can I insert a photo into a table in the "Table" mode?

3. Where in the database will the photo appear?

4. What is the difference between the "Create new object" method and the "Create from file" method?

5. How to put a product photo file into the database if it has the extension .png?

6. Is it possible to edit a file that is inserted as an object into the database directly in file system computer?

7. How to insert a presentation into a database?

8. Which application objects can be inserted into the database?

Using data of type OLE Object Field (OLE Object)

An OLE object field is a tool that allows you to link to objects in another application or embed an object in a database. Objects can be simple and formatted texts, pictures, diagrams, audio files (.WAV), music in MIDI format (musical instrument digital interface), animation files (.FLI, .MMM), video clips (.AVI), spreadsheets from other applications that support this tool. software application access, supporting OLE, fully integrated with other applications of the package Microsoft office .

Embedded object is stored in the database file and is always available. By double-clicking on a cell containing an embedded object, you can edit the object using the application in which the object was created.

Related object stored in the object file. The object file can be updated independently of the database. The latest changes will be displayed the next time you open the spreadsheet. When working with a database, you can also view and edit an object. To display an OLE object on a form or report, you must create an Object Attached Frame control.

For example, in the LEMM FREQUENCY table, add the SOUND field, which should contain a record of the pronunciation of the word lemma in the format (.WAV). If you have sound files on your disk with the pronunciation of individual words from the LEMM_FREQUENCY table, you can associate each such sound file with the SOUND field of the table. To do this, open the LEMM_FREQUENCY table and sort it by the lemma field in ascending order (click the arrow next to the LEMMMA field name and then select Sort A to Z). Sorting is done for the convenience of finding the right word. Then select a word for which there is an audio file, such as "grandmother". Next, place the cursor on the SOUND field of the entry with LEMMA = grandmother and press the right mouse button. A drop-down menu will open, in which you need to select the Insert object item. A window will open in which you need to click the Create from file button and then select the sound file on the disk with the pronunciation of the word "grandmother". An inscription will appear in the SOUND field. package. Now if you double-click on this inscription, the program for playing sound files will be called (as a rule, this is a player Windows Media) and the word "grandmother" will sound. The same actions should be performed with all words for which sound files are available. As a result of the operation, the words of the table for which you can listen to their sound will be marked accordingly (Fig. 14.9).

Rice. 14.9.

Using Data Type Hyperlink

Special data type Hyperlink hyperlink ) allows you to store hyperlinks in the fields of database tables access. Fields of the Hyperlink type are used to navigate to objects in the same or another database access, to documents created in various applications Microsoft Office and located on local or network drives, to Web server pages, and documents from other resources on the Internet. Clicking on a hyperlink navigates to the document that is opened by the application that created it.

To attach hyperlinks to database data, you need to perform the following sequence of actions. Let's add a DICTIONARY field to the FREQUENCY_LEMM table, which will contain hyperlinks to dictionary entries on the Internet with definitions for this lexeme.

In Design mode, set the type of this field = Hyperlink.

We will search the Internet for the meanings of words from a fairy tale that are outdated and not entirely clear to the modern reader, for example, "zhernovets", "boyar", "kochetok".

For the first word (“millstone”), only a drawing was found on the Internet depicting the details of a hand mill, among which there are two small millstones, suppose that these are “millstones” (club-kaup.narod.ru/rec/arcussr/tablell2 .jpg). The word "zhernovtsy" is formed as a diminutive from the word zhernov according to the tradition of Russian word formation. For the second word - "boyar" there is a dictionary entry in Wiktionary (en.wiktionary.org/wiki/boyar). The third word, kochetok, was found on the website "Dictionaries and Encyclopedias Academician" in the electronic version of Ushakov's Dictionary (dic.academic.ru/dic.nsf/ushakov/842550).

Each link found must be copied into the DICTIONARY field of the FREQUENCY table. Subsequently, clicking on a link in this field will launch an Internet browser program that will open the corresponding web page in a separate browser window. The view of the Access database table with inserted hyperlinks is shown in fig. 14.10.

Share with friends or save for yourself:

Loading...