Export file Name

jquickuk

Registered User.
Local time
Today, 11:42
Joined
Mar 18, 2009
Messages
12
Afternoon all,

my Database is nearlly all finished just one thing needs doing.

I have a query that I run in VB, then it exports it into a CSV file to a folder on the C drive.

When you run the code it goes to the query where it asks for the date and the CSV file is based on that.

What I need it to do is save it as Cancellation "Cancel_date"
The query name is "Cancellations"

currently I have
strFile1 = "C:\Cancellations\Cancellations" & Format(Date - 1, "yyyymmdd") & ".csv"

This works fine and save it as Cancellation 20090419.CSV

I have tried
canceldate = "Cancellations.Cancel_date" - Cancellations being the query and Cance_date the field
strFile1 = "C:\cancellations\cancellations " & canceldate & ".csv"

This doesn't work. Any ideas?

Thanks
 
Last edited:
i forgot to metion when i do try it with above the file name comes out as

Cancellations Cancellations#Cancel_date.csv
 
the problem is that cancel date will look like 14/4/2009

and the / characters are illegal in a file name

just use format(canceldate,"yyyymmdd") and you will be ok
 
Oh yeah forgot about that.
i did change it but the file name is still not picking up the date that I enter into the query.

I still get file name: Cancellations Cancellations#Cancel_date.csv
 
Last edited:

Users who are viewing this thread

Back
Top Bottom