Designing Advanced Forms Customizing Forms in Design View: − Create a form in Layout view: Choose Create Forms Blank Form.. Adding Controls to Your Form To add a control, follow th
Trang 1Building a User Interface
with Forms
Trang 2Creating Simple Forms
Creates a readymade form based on a table or
Trang 4More Useful Form Properties
The Property Sheet to change the view of your
form, letting an ordinary form show multiple items or a split view
However, the Property Sheet is packed with
many more settings
(reference to Table 12-2, Page 396)
Trang 5The Form Wizard
The Form wizard asks you a series of questions
and then builds a form to match
− Choose Create Forms Form Wizard.➝ Forms ➝ Form ➝ Forms ➝ Form
− From the drop-down list, choose the table you want to use
− Add the fields you want to include, click Next
− Choose a layout option for your form
Trang 6The Form Wizard
Layout options include:
− Columnar similar to clicking Create Forms ➝ Forms ➝ Form
Form on the ribbon
Trang 7Designing Advanced Forms
Customizing Forms in Design View:
− Create a form in Layout view: Choose Create
Forms Blank Form
− Drag the fields from the Field List pane into form
− Create a form in Design view Choose Create
Forms Form Design Start with a blank form in the design window
− Drag fields from the Field List pane into form
Trang 8Form Sections
Newly created forms start with only one
section: the Details section, which defines the content for each record
Trang 9Form Sections
To add a title or logo at the top of form, or some
sort of summary information or message at the bottom, must include a header and footer section
To add these elements to form, right-click
anywhere on the form’s surface, and then choose Page Header/Footer
Trang 10Adding Controls to Your Form
To add a control, follow these steps:
− Head to the ribbon’s Form Design Tools Design Controls section
− Optionally, switch on the Use Control Wizards button
− Click the icon for the control you want
− To place your control on the form, drag the mouse cursor to draw the control on the form
− If control has a Control wizard and use Control Wizards, the wizard appears now
Trang 11Adding Controls to Your Form
− If you’re adding a label, supply some text for the control
− Change the appropriate settings in the Property Sheet
− Give control a better name by setting the Name property
− Format your control.
Form controls (reference Table 13-1 Page 407)
Trang 12Arranging Controls on Form
Working with controls in Design view:
− Create a control: Select the control you want, and then draw it in the right place
− Move a control: Just click and drag it You can also move several controls at Once
− Resize a control: Drag the edges of the rectangle that surrounds it
− Modify a control: Select control and set property in the Property Sheet
− Delete a control: Select it press Delete
Trang 13Arranging Controls on Form
Aligning controls:
− Select the control, right-click
− Choose an option in the Align submenu
− Or select Arrange Align
Trang 14Arranging Controls on Form
Sizing controls:
− Select the controls, right-click the selection, choose an option from the Size menu
− Use To Widest to make all the controls as wide
as the widest one of the bunch
Spacing controls:
− To modify the space appears between the controls:
Trang 15Arranging Controls on Form
− Select all the controls Form Design Tools | Arrange Sizing & Ordering Size /Space ➝ Forms ➝ Form ➝ Forms ➝ Form menu
− Select the commands to adjust the spacing between controls:
Equal Horizontal
Equal Vertical
Increase Horizontal and Increase Vertical
Decrease Horizontal and Decrease Vertical
Trang 16Anchoring: Automatically Resizing
Controls
Normally, the controls have a fixed, unchanging
size Fixed size controls make for easy design, but they’re inflexible
Anchoring lets you create controls that can
grow to fill extra space when the Access window is resized
Trang 17Anchoring: Automatically Resizing
Controls
Making controls as wide as the form
− In Design view, shrink the width of the Details section so it’s just wide enough to fit controls
− Choose the controls that you want to expand along with the window’s size
− Choose Form Design Tools Arrange Position Anchoring Stretch Across Top
Trang 18Taking Control of Controls
Locking Down Fields: Every bound control
provides the following two properties that you can use to control editing by using the Property Sheet in Design view
− Locked determines whether you can make
changes in a field
− Enabled lets you deactivate a control
altogether
Trang 19Taking Control of Controls
Prevent Errors with Validation:
− Validation Rule sets an expression that the value must meet to be considered valid
− Validation Text
− Input Mask
− Default Value
Trang 20Performing Calculations with
Expressions
To create an expression on form:
− Add a text box control to your form
− In the Property Sheet, choose the Data tab Place expression in the Control Source setting
− Optionally, set Enabled to No to hammer home the point that this value can’t be edited
− Optionally, apply formatting
Trang 21Organizing with Tab Controls
Tab control is used:
− Present large amounts of content in a limited space Organize this content into separate pages At a time, can see only one page
− In forms that are primarily designed for editing or reviewing data, data can be subdivided into logical groups, and editing tasks often involve just one group
Trang 22Organizing with Tab Controls
To use a tab control, follow these steps:
In the ribbon’s Form Design Tools Design
Controls section , click the Tab Control
Draw the tab control onto form
Every new tab control starts with two pages
− To create a new page, right-click any tab and choose Insert Page
− To remove an existing page, right-click it and choose Delete Page
Place controls on the different pages
Trang 23Navigating with Lists
There are two list controls in Access forms: the
list box and the combo box
There are two ways to use list controls:
− Use to edit a field Access automatically creates a combo box control when there’s a lookup defined for the field
− Use to navigate to the record, the list shows the field value for every record in the table When choose one of the values, Access jumps
to the corresponding record
Trang 24Navigating with Lists
Create List control:
− Make sure the Control Wizard feature is turned on
− In Form Design Tools Design Controls section, click List Box or Combo Box
− Draw the control on the form
− Choose “Find a record on my form” Next
− Choose the field you want to use for the lookup Next
− Enter a caption for list Finish
Trang 25Command Buttons
Command buttons let you trigger just about any
action, like opening a new form, printing a report…
Crate Button by using wizard:
− In the ribbon’s Form Design Tools Design Controls section, click the Button
− Draw the button into form
Trang 26− Enter some text and choose a picture Next
− Supply a name for the button Finish
Trang 27The Sub form Control
The sub form control shows linked records
Three properties determine what the sub form
control shows:
− The Source Object property identifies the
object in the database that has the related records
− Link Master Fields: is the field in the form.
− Link Child Fields: is the field in the source
object
Trang 28Navigation Forms
Creating a Single-Level Navigation Form:
− To create navigation form, pick one of the top three options from the Create ➝ Forms ➝ Form Forms ➝ Forms ➝ Form Navigation menu
− To add a navigation button for one of forms, click the form in navigation pane, and drag it into the navigation control
− If want to change the navigation button caption, double-click the caption and typethe new name
Trang 29Navigation Forms
Creating a Two-Level Navigation Form:
− To create navigation form, pick one of the bottom three options from the Create ➝ Forms ➝ Form Forms Navigation menu.➝ Forms ➝ Form
Trang 31Linking to Related Data
Showing Linked Records in Separate Forms: By
adding a button to form that pops open another form with the linked records
− Open the parent form in Design view
− Click the Button icon, and draw the button onto form
− Choose the Form Operations Open Form, Next
− Choose the child form that has the related records , Next
Trang 32Linking to Related Data
− Choose “Open the form and find specific data to