Code Examples

Open Import Dialog

acCmdImport

Opens the Import dialog box allowing the user to select both a file and a file type.

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

Private Sub cmdImport_Click()
    On Error GoTo ErrHandler
    DoCmd.RunCommand acCmdImport
ExitHandle:
    Exit Sub
ErrHandler:
    Select Case Err.Number
        Case 2501
            'Do nothing as cancel selected by user
            Resume ExitHandle
        Case Else
            MsgBox Err.Number & vbCrLf & Err.Description
            Resume ExitHandle
    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.