ACC2: How to Create a Custom Toolbar Using a FormID: Q113304
|
Moderate: Requires basic macro, coding, and interoperability skills.
This article describes how to create a custom, floating toolbar using a
Microsoft Access form. Using a form for a custom toolbar provides the
following advantages:
The example below demonstrates how to create a custom, floating toolbar
that has buttons to find, save, delete, and undo a record, as well as
buttons to navigate among the records, including buttons to go to the first
record, go to the previous record, go to the next record, go to the last
record, and add a new record.
Caption: Toolbar
ShortcutMenu: No
ScrollBars: Neither
RecordSelectors: No
NavigationButtons: No
PopUp: Yes
BorderStyle: Dialog
MinButton: No
MaxButton: No
Categories When button Is Pressed
---------------------------------------------
Record Operations Save Record
Record Operations Delete Record
Record Operations Undo Record
Record Navigation Go to First Record
Record Navigation Go to Previous Record
Record Navigation Go to Next Record
Record Navigation Go to Last Record
Record Operations Add New Record
Option Explicit
Function ActivateToolbarForm ()
On Error Resume Next
Forms(Me.Tag).SetFocus
If Err Then
ActivateToolbarForm = False
Else
ActivateToolbarForm = True
End If
End Function
If ActivateToolbarForm() = False Then Exit Sub
Sub Button0_Click ()
If ActivateToolbarForm() = False Then Exit Sub
On Error GoTo Err_Button0_Click
DoCmd DoMenuItem A_FORMBAR, A_EDITMENU, 10, , A_MENU_VER20
Exit_Button0_Click:
Exit Sub
Err_Button0_Click:
MsgBox Error$
Resume Exit_Button0_Click
End Sub
Option Explicit
Sub SetToolbarForm (F As Form)
If IsLoaded("Toolbar") Then Forms![Toolbar].Tag = F.Name
End Sub
SetToolbarForm Me
Sub Form_Activate ()
SetToolbarForm Me
End Sub
Sub Form_Load ()
DoCmd OpenForm "Toolbar"
End Sub
Sub Form_Unload (Cancel As Integer)
DoCmd Close A_FORM, "Toolbar"
End Sub
DoCmd MoveSize 0, 0
For information about how to create a custom toolbar using a form in
Microsoft Access for Windows 95 version 7.0, please see the following
article here in the Microsoft Knowledge Base:
Q142187 ACC95: How to Create a Custom Toolbar Using a Form
Additional query words: tool bar
Keywords : kbusage FmsOthr
Version : 2.0
Platform : WINDOWS
Issue type : kbhowto
Last Reviewed: April 3, 1999