CSV Export File Programmatically (1 Viewer)

access2010

Registered User.
Local time
Today, 04:12
Joined
Dec 26, 2009
Messages
1,021
Our Volunteer staff sometimes creates the wrong CSV file.
Could you please suggest a way of creating the CSV file Programmatically?
===
Using MsAccess 2003

Open the Query = WebExport_Q

Goto = File
Then to = Export
To = E:\Web_Reporting (Folder)
File Name = Web_2019Jan12 (to-day’s date)

Save as type = Csv
Export = All

At Export Text Wizard = X Delimited = Next
At Export Text Wizard = X Comma = Next

Export to File
E:\Web_Reporting\Web_2019Jan12 (to-day’s date)

Then = Finish

==
Your assistance will be appreciated.

Thank you.
Nicole
 

Ranman256

Well-known member
Local time
Today, 07:12
Joined
Apr 9, 2015
Messages
4,337
try not to use Drive letters for network files...instead use full UNC paths:
(but you can if you want)

vFile = "\\server\folder\Web_Reporting\Web_" & format(Date,"yyyymmdd")
docmd.TransferText acExportDelim ,SpecName,"WebExport_Q" ,vFile,true

NOTE: for text you must create a SPECNAME on how to export/import the text.
using a file in the final format, do a manual import text,
select delim/ no delim (top left)
(bottom right ) click ADVANCED
setup the layout, click SAVE AS
enter the SPECNAME

us this SPECNAME in your import.
 

access2010

Registered User.
Local time
Today, 04:12
Joined
Dec 26, 2009
Messages
1,021
Ranman256

Thank you for your suggestion which I have tried below;

The 3 drives are, C, E and F each have a folder “Web_Reporting” on the one local machine
I tried using the following codes without any success;
vFile = "\\server\folder\Web_Reporting\Web_" & Format(Date, "yyyymmdd")
vFile = "\\Web_Reporting\Web_" & Format(Date, "yyyymmdd")
vFile = "\Web_Reporting\Web_" & Format(Date, "yyyymmdd")

Could you please advise me as to what I have done wrong?

Thank you,
Paul
 

access2010

Registered User.
Local time
Today, 04:12
Joined
Dec 26, 2009
Messages
1,021
June7

Thank you for your note, I think that the path below is what you require.

\\Cillia\e\Web_Reporting

Thank you,
Paul
 

June7

AWF VIP
Local time
Today, 03:12
Joined
Mar 9, 2014
Messages
5,468
No, do not use drive letter. Use the full folder pathing.
 

Gasman

Enthusiastic Amateur
Local time
Today, 12:12
Joined
Sep 21, 2011
Messages
14,255
If Cillia is the name of the computer then I believe you will have to use

\\Cillia\e$\Web_Reporting\

or \\localhost\e$\Web_Reporting\
 

access2010

Registered User.
Local time
Today, 04:12
Joined
Dec 26, 2009
Messages
1,021
Gasman

Thank you for your suggestion and,
\\Cillia\e$\Web_Reporting\ = works on the computer "Cillia"

But when we try and use the same code with the computer name changed on other computers, we receive an error report, that the Read Only attribute cannot be changed.

We have tried changing the Attributes without any success, so we will use the "Cillia" computer to create the CVS files.

We appreciate your assistance.
Nicole
 

June7

AWF VIP
Local time
Today, 03:12
Joined
Mar 9, 2014
Messages
5,468
Exactly what is your network setup?

Is Cillia name of your network file server?

Is 'e' or 'e$' the mapped drive letter?
 

Gasman

Enthusiastic Amateur
Local time
Today, 12:12
Joined
Sep 21, 2011
Messages
14,255
June7,

I was guessing that they were exporting to a local drive, and so could use the default map protocol.
 

June7

AWF VIP
Local time
Today, 03:12
Joined
Mar 9, 2014
Messages
5,468
If the requirement is to dynamically reference workstation computer name, it can be grabbed with Environ("COMPUTERNAME"). So maybe:

vfile = "\\" & Environ("COMPUTERNAME") & "\e$\Web_Reporting\"

But I guess 'localhost' should provide the dynamic reference as well.

So if 'e$' is mapped drive letter, this requires every computer to have this same letter mapped which defeats the whole idea of using UNC pathing.

Is Web_Reporting a folder located on the local drive, not a central file server?
 
Last edited:

Users who are viewing this thread

Top Bottom