Code Examples

Spacing Options

acCmdHorizontalSpacingMakeEqual, acCmdHorizontalSpacingIncrease, acCmdHorizontalSpacingDecrease, acCmdVerticalSpacingMakeEqual, acCmdVerticalSpacingIncrease, acCmdVerticalSpacingDecrease

This routine allows you to display a 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 "SpacingTools"
  2. Add the required buttons to the toolbar.
  3. Name the buttons as appropriate. Set the on action property to "=ControlSpacing("HEqual")" etc.
  4. Add the ControlSpacing function to a module
  5. Display the Toolbar "SpacingTools" 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.


Function ControlSpacing(SpaceType As String)
  'Accepts a string to determine type of spacing required
  Dim strCheck As String

  strCheck = UCase(SpaceType)

  Select Case strCheck
    Case "HEQUAL"
      'make the items equally spaced horizontally
      DoCmd.RunCommand acCmdHorizontalSpacingMakeEqual
    Case "HINCREASE"
      'increase space between items horizontally
      DoCmd.RunCommand acCmdHorizontalSpacingIncrease
    Case "HDECREASE"
      'decrease space between the items horizontally
      DoCmd.RunCommand acCmdHorizontalSpacingDecrease
    Case "VEQUAL"
      'make the items equally spaced vertically
      DoCmd.RunCommand acCmdVerticalSpacingMakeEqual
    Case "VINCREASE"
      'increase space between items vertically
      DoCmd.RunCommand acCmdVerticalSpacingIncrease
    Case "VDECREASE"
      'decrease space between the items vertically
      DoCmd.RunCommand acCmdVerticalSpacingDecrease
  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.