API OpenFile Dialog

J

Jeff C

I use the transfertext import action alot. I am trying to apply the:

API: Call the standard Windows File Open/Save dialog box
from the Access web to my transfer text argument so that I have the option
of choosing the file to import.

I saved the module and the following brings up the File Open dialog.

DoCmd.TransferText acImportFixed, "ImportSpec", "DestinationTable", TestIt

I have been modifying things now since yesterday but I cannot figure out the
correct syntax to get my file choice to passthrough as the string so the file
gets imported.

Could someone please offer more guidence? Thank you
 
A

Alex Dybenko

first you call file dialog:
strInputFileName = ahtCommonFileOpenSave( _
Filter:=strFilter, OpenFile:=True, _
DialogTitle:="Please select an input file...", _
Flags:=ahtOFN_HIDEREADONLY)

then check if user select any file, and if yes - pass it to transfertext
method:

if len(strInputFileName) >0 then
DoCmd.TransferText acImportFixed, "ImportSpec", "DestinationTable",
strInputFileName
end if

--
Best regards,
___________
Alex Dybenko (MVP)
http://alexdyb.blogspot.com
http://www.PointLtd.com
 
J

Jeff C

Thank you , Thank you, Thank you
--
Jeff C
Live Well .. Be Happy In All You Do


Alex Dybenko said:
first you call file dialog:
strInputFileName = ahtCommonFileOpenSave( _
Filter:=strFilter, OpenFile:=True, _
DialogTitle:="Please select an input file...", _
Flags:=ahtOFN_HIDEREADONLY)

then check if user select any file, and if yes - pass it to transfertext
method:

if len(strInputFileName) >0 then
DoCmd.TransferText acImportFixed, "ImportSpec", "DestinationTable",
strInputFileName
end if

--
Best regards,
___________
Alex Dybenko (MVP)
http://alexdyb.blogspot.com
http://www.PointLtd.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top