Code Examples

Best Fit


This code will only work from a toolbar. Add the following code to a module. Now add a button to a toolbar and set its action to =SizeFit().

'***************** Code Start *******************
' Code by Terry Wickenden

Function SizeFit()

  On Error GoTo ErrSizeFit

  DoCmd.RunCommand acCmdSizeToFit
  Exit Function


  Select Case Err
    Case 2046
      'Command not available
      MsgBox "Size to fit is not available at this time." & _
        vbCrLf & "Please ensure that you have selected a control.", _
        vbCritical, "Not Available"
    Case Else
      MsgBox Err.Number & ":-" & vbCrLf & Err.Description
  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.