VB Code:
Private Sub cmdAccess_Click()
'Need this in case user clicks cancel
On Error GoTo cdlg_err
'Setup the common dialog control and show the open file dialog
With CommonDialog1
.DialogTitle = "Microsoft Access Files"
.DefaultExt = ".mdb"
.Filter = "Microsoft Access Files|*.mdb"
.ShowOpen
End With
Exit Sub
cdlg_err:
'Check to see if the cancel button generated the error,
'if not, show the error message
If Err.Number <> cdlCancel Then
MsgBox "Error #" & Err.Number & vbCrLf & Err.Description
End If
Exit Sub
End Sub