This code almost works only its pulling a type mismatch error - it is an activeX form that allows the user to browse to a file and then have the file name and path changed to a string and then used in transferdatabase routine - take a peek and recommend where I may have to tweeeek something please:
John Kolker
Programmer
jwkolker@comcast.net
Code:
Private Sub cmdBrowse_Click()
'setup declarations
Dim strFile As String
Dim CurrentFile As String
Dim Path As String
On Error GoTo Closeit:
DoCmd.SetWarnings False
'use active x file open object
With Me.cdlgopen
.CancelError = True
.Filter = "dBASE Files (*.dbf)"
.ShowOpen
strFile = .FileName
CurrentFile = strFile
DoCmd.TransferDatabase acImport, "dBASE III", strFile, acDefault, "Vendpay"
MsgBox "This file was just imported successfully - " & strFile, vbInformation, "Done..."
DoCmd.SetWarnings True
DoCmd.Close acForm, "f-getfundfile"
Exit Sub
Closeit:
DoCmd.Close acForm, "f-getfundfile"
MsgBox "No File was imported!", vbCritical, "Uh-Oh......"
End With
End Sub
Private Sub Close_Click()
On Error GoTo Err_Close_Click
DoCmd.Close
Exit_Close_Click:
Exit Sub
Err_Close_Click:
MsgBox Err.Description
Resume Exit_Close_Click
End Sub
John Kolker
Programmer
jwkolker@comcast.net