Thanks Ken.
That makes since but I have another question now. The "=" worked but it
would only return a folder path not the entire file ("C:\Desktop") instead
of
("C:\Desktop\SearchResults.xls") so I added "\SearchResults.xls" to the
additem line from the below code like this... Me.FileList.AddItem
varFile +
"\SearchResults.xls"
So I have a button running the below code that populates my listbox field
and GoesToControl Filelist (my listbox). I then have a macro that exports
the query to the location listed in the listbox. I am calling the macro
"On
Got Focus" of the list box. However the macro only exports the file part
of
the time. So I am assuming that it is not always getting called. I know
the
"On Got Focus" probably isnt the best place to put it so I tried calling
it
at the end of the below code but couldn't get that to work right either.
Any ideas as to make this macro run everytime.
Thanks Again.
Ken Snell (MVP) said:
Use an expression in the FileName portion so that it uses the value from
the
FileList control (note the = sign at the beginning):
=[Forms]![frmReportingDatasheetView]![FileList]
consjoe said:
I am using the below code to open my dialog box and then it populates my
listbox. I then am using a macro to export a query to that location.
Question is, how do I name the excel file I export? I am currently
using
the
TransferSpreadsheet and the File Name I am using is what is populated
in
my
list box. In other words I have
[Forms]![frmReportingDatasheetView]![FileList] in the "File Name"
portian
of
my TransferSpreadsheet function. When I export my query the file will
go
to
the chosen folder but will be named
"[Forms]![frmReportingDatasheetView]![FileList].xls"
Is there anyway to make the name something useful?
I am also having the same naming problem when I import.
Do I need to convert this to a module?
Thanks!!
<snipped >