Selecting drive or path to export to

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have used the common add/save dialog box to let a user find a file he wants to import, but I can't figure out how to let them just select a directory or a drive (like A: or B:) to import specific files from or export files to. I don't want to use an input box, because it is too easy for them to incorreclty enter a path.

The code (part of it) I use to identify a specific excel file to import is this:
strFilter = adhAddFilterItem(strFilter, " (*.xls)", "*.xls")
lngFlags = adhOFN_HIDEREADONLY Or adhOFN_HIDEREADONLY Or adhOFN_NOCHANGEDIR

varFileName = adhCommonFileOpenSave( _
OpenFile:=True, _
Filter:=strFilter, _
Flags:=lngFlags, _
DialogTitle:="Locate Data database file")

But this requires a file name in order to be able to select "Open" in the dialog box. The intent is to have the user identify a path or the root directory of a drive (A:\) to copy a bunch of files to. Once they have identified the path, the code will use the TransferText action to send it to the "Destination" & "filename.txt"
 
There is code at the following that will allow you to do that:

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

After you have reviewed that link, you might want to go here (in case you
are using the Common Dialog control, which is prone to licensing and
versioning problems) and review the code for selecting a file:

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

hth,

--

Cheryl Fischer, MVP Microsoft Access
Law/Sys Associates, Houston, TX


rbm said:
I have used the common add/save dialog box to let a user find a file he
wants to import, but I can't figure out how to let them just select a
directory or a drive (like A: or B:) to import specific files from or export
files to. I don't want to use an input box, because it is too easy for them
to incorreclty enter a path.
The code (part of it) I use to identify a specific excel file to import is this:
strFilter = adhAddFilterItem(strFilter, " (*.xls)", "*.xls")
lngFlags = adhOFN_HIDEREADONLY Or adhOFN_HIDEREADONLY Or adhOFN_NOCHANGEDIR

varFileName = adhCommonFileOpenSave( _
OpenFile:=True, _
Filter:=strFilter, _
Flags:=lngFlags, _
DialogTitle:="Locate Data database file")

But this requires a file name in order to be able to select "Open" in the
dialog box. The intent is to have the user identify a path or the root
directory of a drive (A:\) to copy a bunch of files to. Once they have
identified the path, the code will use the TransferText action to send it to
the "Destination" & "filename.txt"
 
Back
Top