Code Examples

Display Save As Choice

acCmdSaveAs

The example selects the form whose name is passed to it and then displays the choice of saving as a new object in the present database or exporting the form.

' ***************** 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.

Sub FormSaveAs(strForm as String)

  On Error GoTo ErrSaveAs

  DoCmd.SelectObject acForm, strForm, True
  DoCmd.RunCommand acCmdSaveAs
  Exit Sub

ErrSaveAs:
  Select Case Err
    Case 2501
      'Cancel Selected in Dialog Box
    Case 2544
      'Form does not exist
      MsgBox strName & " is not a valid form name.", vbCritical, "Save Problem"
    Case Else
      MsgBox Err & ":-" & vbCrLf & Err.Description, , "Save Problem"
  End Select

End Sub

' ******************* 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.