Access Tips

Back to Hints and Tips Index                                             Back to Main Index

Remove task shortcuts from the Database window (2000/2002)

One of the few visibly obvious differences between Access 2000 and prior releases was the redesigned Database window. As before, the Database window organises objects according to type. However, most object sheets now includes shortcuts to help you accomplish common tasks quicker, such as creating an object in Design view or using a creation wizard. If you'd rather keep the Database window free of such shortcuts, you can easily hide them. To do so:

  • From the Tools menu select Options from the menu bar.

  • Click on the View tab.

  • Clear the New Object Shortcuts check box.

  • Click OK.

Changing colour of the highlighted record on a form (2000/2002)

This can be done with conditional formatting (a feature added to Access in Office 2000).  

  • For each control on the form that you want to change colour (generally, text boxes and combo boxes, but not list boxes), select the control in Design view.

  • From the Format menu select Conditional Formatting.
    (or select Conditional Formatting from the control's right-click menu).

  • For Condition 1 select Field Has Focus.

  • Select the highlighting colour of your choice.  

This has to be done separately for each control (although you can select multiple controls and apply the formatting collectively). Once you have set the appropriate conditional formatting for all the necessary controls, the highlight will display when the form is opened, either independently, or as a subform on another form.

Prevent users from tabbing to the next record (97/2000/2002)

Typically, pressing the [Tab] key moves focus from one control to the next. When you press [Tab] while the last control on a form has focus, the default behaviour is for Access to switch to the next record and move the focus back to the first control specified in the form's tab order. You may occasionally want to override this behaviour, which you can do by changing the form's Cycle property.

Description of the possible settings for this property:

All Records

This is the default property setting. When [Tab] is pressed and the last control in the form's tab order has focused, focus is moved to the first field control on the next record.

Current Record

When the last control in the tab order has focus, pressing [Tab] moves the focus to the first control in the form's tab order, however Access doesn't change the record with which you're working.

Current Page

If the form has multiple pages, pressing [Tab] cycles between only the controls on the current page and doesn't impact which record is displayed.

Return the name of the folder that stores an application (97/2000/2002)

You may occasionally want to use VBA to determine the name of the folder that an active Access application is stored in. For instance, you may want to use that folder as the default location for data that's exported.

To determine the folder in Access 2000/2002:

use the CurrentProject object's Path property, as in:
 

In a VBA code Module

strFolderName = Application.CurrentProject.Path
 

In the control source property of a text box on a form

=Application.CurrentProject.Path

To determine the folder in Access 97:

If you're using Access 97, you'll need to take a less straightforward approach. The same value can be calculated using the expression:

strFolderName = Left(CurrentDb.Name, _

Len(CurrentDb.Name) - Len(Dir(CurrentDb.Name)))

Note that this expression will leave a slash after the last folder name, whereas the CurrentProject.Path approach doesn't.

If you want to exclude the slash, change the expression to:

Left(CurrentDb.Name, _

Len(CurrentDb.Name) - Len(Dir(CurrentDb.Name))-1)

Back to Hints and Tips Index                                            Back to Main Index