Automate Import

  • Thread starter Thread starter David Hunt
  • Start date Start date
D

David Hunt

I'm attempting to write a simple module that prompts the
user to browse for a file, select the file and then import
the file with a specific import specification.

I know that an Inputbox is not the thing to use. But I
don't know how to call a box with a browse for file
function?

Any help would be greatly appreciated.

*********** Begin Module Code *************

Option Compare Database
Option Explicit

Dim alpha As String


Sub Get_File()
alpha = Interaction.InputBox(Prompt:="File Name")
End Sub

Function Import_File(alpha)
doCmd.TransferText
(acImportDelim,BCCC_Specification,Data_1,[ & alpha & ],,,)
End Function

*********** End Module Code *************
 
David,

Take a look at the code found at:

http://www.mvps.org/access/api/api0001.htm

It creates the standard Windows File Open/Save dialog and is strongly
recommended for questions like yours. While the code may look daunting,
really, it is not. Simply create a new module and name it, say,
basFileUtilities. Copy all of the code from the link into the module and
save it. Then, look at the function TestIt() found within all of the copied
code to see how to use it.
 
Back
Top