How to insert a picture into an access. Inserting objects into a field with the data type ole

To add a background image to an Access form, for example, to the main button form, you need to start the database ("Student performance" with the main button form) and click on the Database Window button on the toolbar. The base window will open access datain which open the Access button form in Design mode.

To add a background image to an Access form, you must open the Button Form Properties dialog box, which you can open in several ways. Let's consider one of the ways: open the Properties window by right-clicking on the button form, and select Properties from the context menu. The Picture: Picture window opens on the Layout tab.


Figure: 1.

To enter the path and name of the picture, click on the browse button, the Select Picture dialog box will open. In this window, you must specify the name and type of the file. By default, Microsoft Office Access supports the .bmp, .dib, .wmf, .emf, and .ico file formats. Therefore, select a picture with one of the specified extensions and click the OK button in the Select Picture dialog box. I chose the .bmp extension for the picture.

Next, in the Picture: Picture window, specify the type of picture, it can be embedded or linked. The main differences between binding and embedding (embedding) are where the data is stored and how the data is updated after it has been placed in a document. Embedded drawing is an integral part access forms, i.e. will be stored in the database, increasing its size.

A linked object is data (an object) created in one file and inserted into another file with support for linking between files. The linked object is not part of the file in which it is inserted, but is stored in the original file in one of the PC directories, without increasing the size of the database. If a picture or company logo needs to be placed on each form and in reports, then it is advisable to insert the picture as a linked object.

I chose the embedded image, since it is an integral part of the Access database, which allows Internet users to copy (download) the database file from the site.

The next step is to set the dimensions of the picture. The scale of the picture has the following meanings:

  • Fragment;
  • Fit to frame;
  • Fit to frame.

Choose one of the values \u200b\u200bdepending on the purpose. In the button form Access Student_Progress I chose the scale of the picture - Fragment, alignment - Center, the result is shown in the figure



Figure: 2.

After closing the "Picture: Picture" and "Button Form: Form" windows, double-click on the "Button Form" button, the following Access Main Button Form with a background image will open.



Figure: 3.

Inserting pictures, photos and logos into forms or reports helps improve them appearance and personalizes the Access database.

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

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

Then in the "Table" mode 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).

Figure: 3.38 Inserting an Object

Figure: 3.39 Dialog box for adding a new object to the Access table

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

Figure: 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, which are objects for the database and are external files, then you need to have these 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 is a universal photo format). In order for this file to be saved in the database, in the window (Fig. 3.40) check the box "Create from file" , after which a window will appear, which is shown in Figure 3.41. Using the button "Overview" select the required file.

Figure: 3.41 Finding a file when creating an object in the database

In the corresponding line for the field e.g. "Product photo" a word will appear "Package", this means that the file is associated with the application with which it was created. Therefore, when viewing the database, whether it be 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 photo). The only exceptions are 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 conclusion 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 to create multiple files with photos and text using different Windows editors. For example, you can open a Word document, insert a photo from the file, add text, and then save as: Monitor.docx(fig. 3.42).

Figure: 3.42 Photo file created in Word

2. Creation of new objects.

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

Figure: 3.43 List of Access Object Types You Can Use to Create Files

The convenience of using applications for creating objects in the form of files lies in the fact that in the future these files can be used autonomously or corrected in the database.

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

For example, you need to create an object with an image of a company and text, which 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 photo from file.

3. Add text (if necessary).

4. Save as file.

5. Close the application.

Figure: 3.44 Object creation technology in Paint

The task 3.11

1. In the table “ Products"In the mode "Constructor" add a new column named "Product photo", data type " OLE Object Field ", save your changes.

2. In the mode "Table" in field "Product photo" select the line "Insert object from file", select (dot) "Create new" and from the dropdown list document Microsoft Word ... This will open a text editor MS Word, here you need to insert a picture corresponding to the product in this line. Select pictures from the list that is stored directly in the editor (the "Insert" tab, the "Picture" icon, the "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 linked to your database, to the line in which it was inserted.

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

4. Save your changes.

test questions

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

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

3. Where in the database will the photo be displayed?

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. Can you edit a file that is inserted as an object into the database directly in the computer's file system?

7. How to insert a presentation into the database?

8. What application objects can I insert into the database?

Access 2002 allows you to specify not only smooth colors as the background of a form, but also bitmap images stored in various graphic formats, such as WMF and BMP. Access 2002 ships with several bitmap graphics, which are stored in the Microsoft OfficeOfficelOBitmapsStyles folder.

To set a background image for a form:

  1. In Design mode, select the entire shape. To do this, left-click on the square in the upper left corner of the Form Designer window, where the vertical and horizontal rulers intersect. After selecting the shape, a black square will appear at the intersection of the rulers.
  2. On the toolbar Form constructor (Form Design) click the button Properties (Properties). The form properties window will appear (Fig. 5.24).

    Figure: 5.24. Form properties window

  3. Expand the tab Layout (Format) in the properties window of the form and use the scroll bar to move to the bottom of the list of properties, where the property is located Picture (Picture).

    Figure: 5.25. Dialog window Selecting a pattern

  4. In the property field Picture enter the path and name of the image file or use the Builder: place the insertion point in the field Picture, then press the button Build (Build), which will appear to the right of the field as a small square with an ellipsis on it, after which a dialog box will open Selecting a pattern (Insert Picture) (Fig. 5.25), with which you can find and specify the required picture file. This dialog is standard dialog box opening files in Windows. After the picture file is found, select its name, and then press the button OK. Access will display the path and file name in the property box Picture.
  5. To close the form properties window, click Close (Close) at the top of the window.

Unlike background colors, the background image applies to all sections of the form. To remove the background picture just remove the content of the property text box Picture.

Also, using the properties grouped in the tab Layout form properties window, you can customize the display of the background image. Property Pattern type (Picture Type) defines the method that Access uses to attach a picture to a form. Select an item from the dropdown list of this property Rooted (Embedded) if you intend to distribute the application between users and the form should not use external files that can be moved or deleted. If there are many shapes that use the same background, then from the drop-down list, select Connected (Linked), which will reduce disk space usage by including a wallpaper on the form by linking to a picture file.

Using the property The scale of the drawing (Picture Size Mode) You can define the size of the wallpaper. To display the picture in its original size, in the drop-down list of this property, select Fragment (Clip). When choosing a value Fit to frame (Stretch) the drawing is stretched or shrunk horizontally and vertically to fit the shape; in this case, it is possible to change the proportions of the picture. Value selection Fit to frame (Zoom) will stretch or shrink the picture proportionally to the maximum possible size without cropping the picture.

To determine the position of the wallpaper, select one of the following property dropdown items Aligning the picture (Picture Alignment): Top left (Top Left), Top right (Top Right), Center (Center), Bottom left (Bottom Left), Bottom right (Bottom Right) either Center of the form (Form Center).

Comment

To have the background image centered on the form rather than the form window, set the property Aligning the picture value Center of the form, not Center.

If the property Mosaic filling (Picture Tiling) is set to Yes, then in the form window or in the entire form (depending on the value of the property Aligning the pattern) a repeating pattern is displayed.

After you change the value of a property, the result of that change is immediately displayed on the form.

Form printing

The form, like any other document, can be printed. First, you need to prepare the form for printing.

1. Open the sample database Sales department.

2. In the navigation area, double-click the name of the form Main form Clientsto open it.

3. Right-click on the header of the form and select the item Constructor.

4. Now right-click in the data area and select Properties... The properties window discussed in the previous sections will open.

5. In the properties window go to the Layoutand for property Striping background colorspecify a color similar to the background color.

Form data can be printed out by interleaving the color of the data area so that you can easily see where the data area of \u200b\u200banother record begins. Another method that can be used is to output data for each record from a new page.

1. Right-click in the annotation area and select Properties... The properties window will open.

2. In the properties window go to the tab Layoutand for property Output modeindicate Screen only.

There are no annotations in our form, so there is no need to print the annotation area.

3. Go to the tab Constructorand from the group Control elementsselect tool Insert page break.

4. Specify the location for the page break by clicking on the bottom edge of the data area.

The form is now ready to print. You can use the preview function to check what the printed data will look like.

1. Open the main menu of the application by pressing the button Officein the upper left corner of the Access window.

2. From the menu, select Printing.

4. In a group Scaleselect a two-page layout on one sheet (Figure 3.25) to see how the first and second pages will look.

Figure: 3.25.Preview

5. Press the button Printing

in the tab Preview... A window will open Printing(fig. 3.26).

Figure: 3.26.Print window

6. In the field Nameselect your printer from the list of printers installed on your system. In field conditionthe printer is ready to print. If the condition is different from Ready, choose a different printer or troubleshoot.

7. If you want to print to a file, select the print to filegroup a printer.

8. In a group Printspecify the range of pages to print.

9. In a group Copiesspecify the number of copies.

10. Press the button Customization, after which a window will open Page settings(fig. 3.27).

Figure: 3.27.Page Setup window

11. In a group Fieldsspecify the sizes of the fields. The results of your changes are displayed in the preview window Sample.

For a split form, you can also specify which part to print.

12. Press the button OK.

If you want to check the properties of the printer, click Properties... The window that opens and its contents depend on the type of printer.

13. When ready to print, press the OK.

14. If you are printing to a file, a window will appear Print to file(fig. 3.28). Specify a file name and click OK.

Figure: 3.28.Print to file window

15. If you selected an existing printer for printing, a message about the printing process will appear immediately. Now you can any shape in Microsoft Access 2007. The next section will look at using a form as an interface for working with data.

Next chapter\u003e