Forms & Reports:
Form View

Title: Jan's Illustrated Computer Literacy 101
Did you want: Working with Databases: Access 2007/2010/2013


So far you have worked primarily with the Form Design View. You have already learned how to navigate between records and how to enter data in a form. We need to discuss a few more things about Form View.

  • Why the form's window size may not be the real size

  • How to control the order that TAB and arrow keys move through the controls

  • How to disable a control

  • How to make a form read-only

  • How to create a data entry form


Where you are:
JegsWorks > Lessons > Databases

Before you start...

Project 1: Intro

Project 2: Access Basics

Project 3: Tables & Queries

Project 4: Forms & Reports Arrow: subtopic open
    Import/Export/LinkTo subtopics
    Designing Forms Arrow: subtopic open
    Icon: StepForm Wizard
    Icon: StepControls
    Icon: StepCreate Form Manually
    Icon: StepFormat Form
    Icon: StepTab Control
    Icon: StepForm View
         Images in Forms & Reports
    Icon: StepForm Images
    Icon: StepRecord Images
    Icon: StepPrintable Form
    Designing ReportsTo subtopics
    Special Forms & ReportsTo subtopics
    Summary
    Quiz
    ExercisesTo subtopics


Search  
Glossary
  
Appendix



Window Size Confusion

Did you notice? When you open a form from the Database Window, Access sizes the form's window to show all of one record, by default. That is usually a very good idea!

If you open the form from the Database Window in Form Design View, Access sizes the design window to show the whole form. This is also a good idea. This window is larger than the window needed in Form View because Form Design View needs space for rulers and section bars and scrollbars.

When you switch back and forth between Form Design View and Form View, the window size stays the same. If the window was sized for designing automatically by Access or by you manually, when you switch to Form View, the window is not be the size your users will see when opening the form directly! Confusing!

Icon: Mouse click Click on the image to see what the other view looks like in that size window.

Form View: To Fit

Form Design View: To Fit

Form View - opened directly Form Design View - opened directly

Tab Order

You can use the TAB key to move the focus from control to control in both Form and Form Design Views, but there are differences in the order. It is important that data entry forms have a logical tab order! It is best if the tab order matches the order in which the user will naturally try to enter data.

Tab order is set in Form Design View in the Tab Order dialog, but surprisingly it only applies to Form View. You set the tab order separately for each section. Of course you do not usually have many data controls in the headers or footers. The Detail section holds all of the controls for a record.

In Form Design View:

  • Use TAB key only to move the focus from control to control. (Arrow keys move the selected control!)
  • The tab order is always the order that the controls were put onto the form.
  • All controls are part of the TAB order, including labels, lines, rectangles, and pictures.
  • Set the tab order for Form View using the Tab Order dialog.  View | Tab Order...

In Form View:

  • TAB and arrow keys both work to move the focus from control to control.
  • The tab order is the order in the Tab Order dialog, which you can open only in Form Design View.
  • The default tab order is the order in which the controls were added to the form.
  • Only data controls are part of the tab order, not labels, lines, rectangles, or pictures.

It is important that the tab order be logical! If you moved fields around or inserted them without considering the order, you will need to change the tab order.

Setting Tab Order

Form View: controls not in single columnForms that are not arranged with a single column of controls may need a different tab order.

You can open the Tab Order dialog while in Form Design View from the View menu.

Menu: View | Tab Order
 

Dialog: Tab Order - controls out of orderThe Tab Order dialog at the right shows that tabbing through the controls in the example form, the tab order will move from Comment (which is Medical Info) to T-shirt size, then to T-shirt type, which is the last control in the list.

But, the way the controls are arranged on the form, the focus should move down the left column to Grade and then to T-shirt type, then T-shirt size, and then to the top of the next column, Home Phone.

To change the order, you move the mouse pointer over the left side of the list until it turns to the Select Row shape Pointer: Select Row. Click on a name or click and drag across several names to select them. Then move the mouse pointer over the square at the left until it turns to the Select shape Pointer: Select. Then you can drag the selected items to a new position. A thick black line shows where the selection will be dropped when you release the mouse button.
 

Dialog: Tab Order - Auto OrderThe Auto Order button on the dialog sets the order as left-to-right and then top-to-bottom. The tab order at the right shows the Auto Order. Compare this to the example form. Tabbing in Auto Order will move you across the form first and then drop down and go across again. Sometimes that is just what you want, but not for the example form.


Remove from Tab Order

Calculated controls and AutoNumber controls should not be in the tab order. You don't want your users trying to enter data in them! Plus, it is annoying to users to have to tab extra times to get past controls that they cannot edit.

Surprisingly, the Tab Order dialog does not let you delete items from the list. In the Properties Dialog for the control you want to delete, however, the Tab Stop property is just what you need for this situation. Just select the control, open the Properties dialog, set the Tab Stop property to No. The control is still clickable, so a user can select it. But the TAB and arrow keys will skip the control.

Form Design View: Tab Stop = No

Disable a Control

Form View: disabled controlDialog: Properties - Enabled = NoIf you want to be sure that a user does not try to type in the field, you can also set the Enabled property to No. Controls that are disabled have a different color background and grayed out text. The label text is also grayed out.

Warning: The user cannot copy the value from the control either. Is that important for your form??
 


Icon: Step-by-Step 

Step-by-Step: Form Views

 Icon: Step-by-Step

What you will learn:

to observe how Access sizes windows
to use Properties to control window position/size
to change the tab order for Form View
to remove a control from the tab order
to disable a control
to make the form read-only
to create a data entry form

Start with:  Class diskresource files, worldtravel.mdb from the previous lesson

Window Size

  1. Form Design View: Clients-header, shows whole formOpen the form Clients-header from the Database Window directly to Form Design View.
     The window is automatically sized to show all of the controls and sections.
     
  2. Form View: Clients-header, shows whole record - same size window as in Design ViewSwitch to Form View.
    The window is far larger than is needed.

     
  3. Close the form.
     
  4. Form View: Clients-headerOpen the form Clients-header from the Database Window directly into Form View.
    The form is automatically sized to show the entire record, leaving space for scrollbars.

    TipForm Scrollbars: The form view will allow space for scroll bars, even if you don't need actually need any scrollbars at the current window size. Access is trying to help you out. The size of a record in the form can change if controls are allowed to Grow! You would need scrollbars to get to the controls that got pushed out of sight at the bottom of the form.
     
  5. Form Design View: window too smallIcon: Design Switch to Form Design View and inspect the window.
    The window size stayed the same. The bottom part of the form is out of sight. <sigh>
     
    This is not a problem once you have finished designing a form. Just remember: If you enlarge the window in design view, it will be enlarged in form view also while you work.
     

Form View: Window Position

When you save from Form View, the window's size and position are saved. But... there are some properties that may override your choices: Auto Resize and Auto Center.

By default AutoResize is set to Yes and Auto Center is set to No.

  1. Switch to Form View.
     
  2. Form resized at leftResize the window narrower and taller by dragging its edges.
     
  3. Move the form window to the far left of the Access window.
     
  4. Icon: Save Save the form and close it.
     
  5. Form autosized at leftReopen the form directly into Form View.
    The position was saved but the size was not.
     
  6. Icon: Experiment Experiment: Play around with the size and positions. Can you find a combination where the width is saved?
    Hint: try the far right.
     
  7. Open the Properties dialog, if it is not already open, by clicking the Properties button Button: Properties.
    The dialog shows the properties of whatever is selected. It is probably the first control on the form.
     
  8. Dialog: Properties Record selectorClick on the record selector bar at the left of the record.
    The Properties dialog changes to show properties for the whole Form.

     
  9. Change Auto Resize to No and Auto Center to Yes.
     
  10. Size the window so that it is NOT at the default size and move it.
     
  11. Icon: Save Save the form and close it.
     
  12. Reopen the form in Form View.
    It should have remembered the size but not the position. It should be centered in the window.

Tab Order

First you should experience the existing tab order, then you can change it to work better.

  1. Icon: Design Switch to Form Design View.
     
  2. Form Design View: Clients-header form, selected unbound control World Travel Inc.Click on the unbound control World Travel Inc. in the header.
     
  3. Press the TAB key on your keyboard move to other controls, observing carefully how the focus is moving through the form, until you cycle back to where you started.
    In this view ALL controls are part of the tab sequence, including labels, lines, rectangles, and pictures.
    The rectangle was selected last before starting over. It was the last object added to the form.
    TipIn Form View with the default properties, using the TAB or arrow keys will eventually move you to the next record.
     
  4. Press the right arrow key.
    Whoops! The selected object moved! Clearly you cannot use the arrow keys in Form Design View to change the focus.
    If you experiment with the arrow keys, be sure to use Undo to get the controls back in position.
     
    Icon: Trouble Problem: Moved controls and Undo does not get them back in position
    Why
    : Only 20 actions are remembered for the Undo list. Happily, you just saved the form.
    Solution: Close the form without saving changes and reopen it.
     
  5. Form View: Clients-header form, first control selectedSwitch to Form View.
    The data control that has the focus has its data selected. It is normally the first control at the top of the form.
     
  6. Press the TAB key repeatedly until you have moved through all of the data controls and the insertion point is in the Date Updated control. The labels and rectangle were not in the tab order in this view.
     
    TipIf there is data in the control, it will be selected. Any typing would replace that data. If there is no data, the insertion point will show at either the left or right edge of the control, depending on how the data is aligned in that control. This can be hard to see when there are no characters in the control!

    Insertion point at left  Insertion point at right

    Text data type aligns left. Number or Date data type aligns right.
     

  7. Press TAB once more.
    The form changes to the next record.
     
    Dialog: Properties - CycleIcon: TroubleProblem: Pressing TAB did not change record
    What happens when you leave the last control in the tab order is controlled by the Cycle property in the Properties dialog for the Form. The default is All Records, which will move the focus to the next record. Other choice are to go to the top of the current record or to the top of the current page (used for tabbed forms).
     
  8. Icon: Design Switch to Form Design View.
     
  9. Dialog: Tab OrderMenu: View | Tab Order...From the menu select  View |  Tab Order...
    The Tab Order dialog appears.

    TipThe AutoOrder button sets the tab order as from left-to-right and top-to-bottom. So TAB would move you across first and then drop down a row. That is NOT what we want for this form.

    The logical tab order for this form would be down the first column, then down the second column, and finally down the third column.
     
    You will change the order by selecting a control's name in the Custom Order list and dragging it to a new position.
     
  10. Dialog: Tab OrderScroll the list of controls in the dialog until you see Birthdate.
     
  11. Move the mouse pointer over Birthdate until it turns into the Select Row shape Pointer: Select Row, a black arrow that points to the right.
     
  12. Drag to select Birthdate, Nationality, and Hobbies.
    You added those fields to the form at the same time, though they were not neighbors on the Field List.
     
  13. Dialog: Tab OrderMove the mouse pointer over the selection squares to the left of the selected items, until it turns into the Select shape Pointer: Select.
     
  14. Drag the selected names up. A black line shows where they will drop.
     
  15. Dialog: Tab Order - moved BirthDateWhen the black line is below Title, drop.
    The selected items move.

     
  16. Similarly, move HealthIssues and Notes upwards until they are below Country in the list.
     
  17. Click on OK to close the dialog and accept the changes.
     
  18. Switch to Form View.
    The first control has its data selected, which shows that it has the focus.
     
  19. Press the TAB key to move from one control to the next to verify that the order is now correct.

    Form View: Clients-header, tab order marked
     

  20. If necessary, make any corrections with the Tab Order dialog.
     
  21. Icon: Design Switch to Form Design View.
     
  22. Click on the label at the top left of the form.
     
  23. Press the TAB key to move from one control to the next again.
    The tab order that you just set did not apply! You always move through the controls in the order that they were created in Form Design View. This can be quite a pain! Smiley: Sad

Remove from Tab Order

The Properties dialog includes properties that keep a user from being able to TAB into a control and also to disable the control entirely. This is useful for calculated or AutoNumber fields.

  1. Form Design View: disabled controlIn Form Design View, double-click on the ClientID control to select it and to open the Properties dialog at the same time.

    TipIf the Properties dialog is already open, it will not close when you double-click a control. It will close if you click the Properties button when the dialog is already open.
     
  2. Change the Enabled property to No.
     
  3. Change the Tab Stop property to No.
     
  4. Click on another property to save the last change.
     
  5. Form View: disabled controlSwitch to Form View.
    The ClientID control is now grayed out and the next control has the insertion point in it. The user cannot edit ClientID .
     
  6. Icon: Save Save the form. (Clients-header)
     

Apply Your Skills: Revise Staff-formated Form

Use the skills you have learned to create a logical tab order for the form Staff-formatted.

  1. If necessary, open the form Staff-formatted in Form Design View.
     
  2. Change the Tab Order to go down the columns and then the Photograph control and then the controls below the line.
     
  3. Disable the StaffID field.
     
  4. Icon: Save Save the form. (Staff-formatted)

Form View: Staff-formatted, tab order marked


Create a Read-Only Form

Sometimes there are users who need to see data, but they don't need to edit the records.

The Properties dialog for the form is your friend for this task. Just a few changes and the whole form becomes read-only. In fact, you could create a database that links to your tables but which only has forms that are read-only. That would certainly keep "accidents" from happening to your records. Keep in mind that a user can still copy data and paste it to a different document.

  1. Icon: Save While in Form Design View for the form Staff-formatted, save the form as Staff-Read Only.
     
  2. Dialog: Properties - Form with settings to make it read-onlyIf necesssary, open the Properties dialog for the whole form.
     
  3. Click on the Data tab.
     
  4. Open and read the Access Help article for the following properties:
       Allow Edits
       Allow Deletions
       Allow Additions
       Data Entry

     

    The first three properties act as expected. "No" means that the action is not allowed.

    But Data Entry is not really about entering data on a form. It is about whether the form will show existing records or will it open with a blank form ready for you to enter new records. The default choice is No, which is what you want for a Read-Only form, for sure!  
     

  5. Set the value to No for all four properties.
     
  6. Switch to Form View.
     
  7. Try to make a change in a value.
    If you made the changes above, you can select data but you cannot make any changes.
  8. Icon: Save Save the form. (Staff-Read Only)

Create a Data Entry Form

A data entry form is a form that is specifically designed for entering new records. Sometimes you need a special form to keep things simple for the person entering the data. The order that data for new records comes in is not the order that you want for viewing it later. Two different logics may be at work. Using two different forms is the solution!

Besides having a different order for the controls, a data entry form should open directly to a blank record. That is what the form's Data Entry property is for!

  1. Switch to Form Design View.
     
  2. In the Properties dialog for the form, change the property Data Entry to Yes.
     
  3. Icon: Save Save the form as Staff-Data Entry
     
  4. Form View: Staff-Data Entry, with no controls showingSwitch to Form View.
    Whoops. The form has no controls for entering data. That would be because we left the Allow... properties at No!
     
    The Properties dialog should still be open. You do not have to switch views to fix this problem!
     
  5. Form View: Staff-Data Entry, with blank recordChange the properties Allow Edits, Allow Deletions, Allow Additions to Yes.
    When the last change is made, all of the controls pop into view!

    Now you can use this form to enter new records.
     
    Notice the navigation buttons at the bottom of the form. There are no other records available! This form will only show the records entered in the current session.
     
  6. Icon: Save Save the form. (Staff-Data Entry)