Jim wrote:
I am trying to import a file using a file spec from the Access File
Open dialog... I have been out to
http://www.mvps.org/access/api/api0001.htm to look at the code, but
because I'm not a guru, I don't quite understand it all. I have gotten
as far as getting the File Open dialog to appear and then tell me what
file I chose, but if someone could help me understand how to take that
file I've selected and import it using my specification, I'd appreciate
it.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Using the following code:
Dim strFilter As String
Dim strInputFileName As String
strFilter = ahtAddFilterItem(strFilter, _
"Text Files (*.txt;*.asc;*tab;*.csv)", _
"*.txt|*.asc|*.tab|*.csv")
strInputFileName = ahtCommonFileOpenSave(Filter:=strFilter, _
OpenFile:=True, _
DialogTitle:="Please select an input file...", _
Flags:=ahtOFN_HIDEREADONLY)
The file name is in the variable strInputFileName. Then use the
variable like this:
DoCmd.TransferText acImportDelimited, "SpecName", "tableName",_
strInputFileName
See the Access VBA Help article "TransferText Method" for more
information.
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv
iQA/AwUBQnaCWoechKqOuFEgEQIFewCeOEt8OOc0VEkan4A6nr682M 0JDHcAni8o
SmFP2jlSOajrCyzMdmGSAYOF
=CJY4
-----END PGP SIGNATURE-----