Microsoft Access. Drawing objects in the form. How to Create a Button in Microsoft Access Opening the Attachments Dialog Box from a Form or Report

- to add a background image to the 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 button on the toolbar Database window.

- the Database window will open, in which open the button form in the mode Constructor.

- open a dialog box Button form properties which can be opened in several ways. Let's consider one of the ways: open a window Properties by right-clicking on the button form and select the command Properties... A window will open Drawing: Picture on tab Layout.

- to enter the path and name of the picture, you need to click on the browse button, a dialog box will open Selecting a pattern.

- 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 on the button OK in the dialog box Selecting a pattern.

- further in the window Drawing 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. The embedded drawing is an integral part of the form, 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.

- select the embedded image, since it is an integral part of the database, which ensures copying (downloading) of the database file from the site by Internet users.

- the next step is to set the size of the picture. The scale of the figure has the following meanings.

Access 2002 allows you to specify not only smooth colors as the background of a form, but also bitmap images stored in a variety of 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 Builder 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).

    Rice. 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 Drawing(Picture).

    Rice. 5.25. Dialog window Selecting a pattern

  4. In the property field Drawing enter the path and file name of the drawing or use the Builder: place the insertion point in the field Drawing, 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 box is the standard Windows file open dialog box. 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 Drawing.
  5. To close the form properties window, click the button Close(Close) at the top of the window.

Unlike background colors, the background is applied to all sections of the form. To remove the background picture, just remove the content of the property text box Drawing.

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 drop-down 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 using the same background, select Connected(Linked), which will reduce disk space usage by including a wallpaper on a 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 the item Fragment(Clip). When choosing a value Fit to frame(Stretch) the picture is stretched or shrunk horizontally and vertically to fit the shape; in this case, it is possible to change the proportions of the picture. Selecting a value 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 and not on the form window, set the property Aligning the picture meaning 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 repetitive image of the 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 Pane, double-click the name of the form Main form Clients to 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 tab Layout and for property Striping background color specify 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 ​​another 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 Layout and for property Output mode indicate Screen only.

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

3. Go to the tab Constructor and from the group Control elements select 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 Office in the upper left corner of the Access window.

2. In the menu, select Seal.

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

Rice. 3.25. Preview

5. Press the button Seal

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

Rice. 3.26. Print window

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

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

8. In a group Print specify the range of pages to print.

9. In a group Copies specify the number of copies.

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

Rice. 3.27. Page Setup window

11. In a group Fields specify the sizes of the fields. The results of the changes you make 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, press the button 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.

Rice. 3.28. Print to file window

15. If you have selected an existing printer for printing, a message will immediately appear informing you that the printing is in progress. Now you can use any form in Microsoft Access 2007. In the next section, we'll look at using a form as an interface for working with data.

Next chapter>