Hi,
I've been searching the forum on how to create a form that will have a command button, that will allow the user to select a file. AFter selecting the file, I want it to import the file into access.
I found this method posted a few times.
http://www.mvps.org/access/api/api0001.htm
so I created the module, and on my form I have this on my button.
This opens the dialot, and displays only .csv files in the directory. But if I select the file and hit OK.
I get an error that strInputFileName.TXT is not valid.
How do I retrieve the path and put it into the transferTEXT command?
I've been searching the forum on how to create a form that will have a command button, that will allow the user to select a file. AFter selecting the file, I want it to import the file into access.
I found this method posted a few times.
http://www.mvps.org/access/api/api0001.htm
so I created the module, and on my form I have this on my button.
Code:
Dim strFilter As String
Dim strInputFileName As String
strFilter = ahtAddFilterItem(strFilter, "Excel Files (*.csv)", "*.csv")
strInputFileName = ahtCommonFileOpenSave( _
Filter:=strFilter, OpenFile:=True, _
DialogTitle:="Please select an input file...", _
Flags:=ahtOFN_HIDEREADONLY)
DoCmd.TransferText acImportDelim, , "mytablehere", "strInputFileName" True
I get an error that strInputFileName.TXT is not valid.
How do I retrieve the path and put it into the transferTEXT command?