Code Examples

Design Toolbar Extra

acCmdPageHdrFtr, acCmdPageNumber, acCmdApplyDefault, acCmdBringToFront, acCmdSendToBack

This routine allows you to display toolbar to assist in the design of a Form or Report. There are a number of steps required to ensure this example works.

  1. Create a toolbar called "FormsTools"
  2. Add 5 buttons to the toolbar in the following order. (These must be the first 5 buttons on the toolbar for this to work as coded)
    1. Name the first button "Show/Hide Page Header" and set the on action property to "=TBFormTools(1)"
    2. Name the next button "Show Page Number" and set the on action property to "=TBFormTools(2)"
    3. Name the third button "Reset to Default" and set the on action property to "=TBFormTools(3)"
    4. Name the fourth button "Bring To Front" and set the on action property to "=TBFormTools(4)"
    5. Name the last button "Send to Back" and set the on action property to "=TBFormTools(5)"
  3. Add the code headed Toolbar Code to a module
  4. Display the Toolbar "FormTools" when in the design of a form or report
'***************** Code Start *******************
' This code was originally written by Terry Wickenden.
' It is not to be altered or distributed,
' except as part of an application.
' You are free to use it in any application,
' provided the copyright notice is left unchanged.

'=========Toolbar Code=============

Function TBFormTools(Index As Integer)

  Select Case Index
    Case 1  'Page header footer
      DoCmd.RunCommand acCmdPageHdrFtr
    Case 2  'Page number
      DoCmd.RunCommand acCmdPageNumber
    Case 3  'Re apply default
      DoCmd.RunCommand acCmdApplyDefault
    Case 4  'Bring to front
      DoCmd.RunCommand acCmdBringToFront
    Case 5  'Send to back
      DoCmd.RunCommand acCmdSendToBack
  End Select

End Function

'****************** Code End ********************

© 1998 - 2011 Terry Wickenden TKW Design Site developed maintained and hosted by TKW Design. This site is best viewed at 1024 x 768. Optimised for Firefox.