473,396 Members | 1,936 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Technique to Export Table to Arbitrary CSV File

Oralloy
988 Expert 512MB
Folks,

I'm trying to export a table to an arbitrary CSV file.

My issue is that the output file name is under control of my application.

Stored exports seem to require a fixed output file. Otherwise I think they'd do just fine for my immediate needs.

Do any of you have any good suggestions or examples I can borrow from?

Thanks,
Oralloy
Sep 21 '10 #1

✓ answered by jimatqsi


5 1833
jimatqsi
1,271 Expert 1GB
Not exactly sure what you mean. But here is some code I use to to create a text file.

Expand|Select|Wrap|Line Numbers
  1.   Dim strLabelFileName As String
  2.    Dim fs As Object
  3.    Dim a As Variant
  4. Dim myVar As Variant
  5. Dim i As Long
  6. Dim rw As Long
  7.     Set fs = CreateObject("Scripting.FileSystemObject")
  8.     strLabelFileName = "ShipLabel_" & Me!txtSelectedOrder & ".txt"
  9.     strLabelFileName = "Y:\ShipLabels\" & strLabelFileName
  10.     Set a = fs.CreateTextFile(strLabelFileName, True)
  11.  
  12. 'Read each line of the PREFIX text file into the list of variables
  13.     'until the end of the file is reached
  14.     i = 0
  15.     rw = 1
  16.     Do While Not (EOF(1))
  17.         Line Input #1, myVar
  18.         i = i + 1
  19.         a.writeline (myVar)
  20.     Loop
  21. 'Close the file
  22.     Close 1
  23.     set fs = nothing
  24.     set a = nothing
  25.  
Jim
Sep 21 '10 #2
Oralloy
988 Expert 512MB
jimatqsi,

Thanks. Not exactly what I'm trying to achieve, though.

Basically I have a table that I'm exporting to a tool called JIRA. That tool can import CSV files, among various formats. It can't reach directly into Access databases, though. So what I am trying to do is automate (as much as possible) the export of a particular table from a fair number of existing Access databases into this common tool.

So, in order to avoid problems with coding my own CSV exporter, I thought that using the built-in capability was the best approach.

The problem is that it seems like the built-in CSV export requires hand execution every time, with the user being the weak link.

I have a mechanism for automated input and output file identification. Now all I have to do is the CSV export piece.
Sep 21 '10 #3
jimatqsi
1,271 Expert 1GB
You might try looking at this

http://bytes.com/topic/access/answers/209333-output-csv

Jim
Sep 21 '10 #4
Oralloy
988 Expert 512MB
jimatqsi,

Thanks!

I'll give it a try and let you know how it works out.

Regards,
Oralloy
Sep 21 '10 #5
Oralloy
988 Expert 512MB
Jim,

It looks like it'll solve my problems. Not a bad piece of code.

Thanks!
Oralloy
Sep 21 '10 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Thomas Massong | last post by:
Hello, i have a problem with an ixf file and need your help. Is there any way to export such a file to ascii or some other readable format for a Windows PC? Unfortunaly we have no other way...
6
by: Oliver Stratmann | last post by:
Hello all, is there another way to export data to a csv-file (comma-separated format)? We tried the EXPORT-command and got the following error " SQL1325N The remote database environment does...
10
by: Neil | last post by:
Hi guyz, just trying out this google feature so if i post if in the wrong area i appologize. now to my question. BTW i'm new to access programming, i've done a little vb6.0 and vb.net but access...
5
by: RadhakrishnanR | last post by:
Hi, By using VB6.0, I want to export database table data into (i.e based on the selected file type(xls or txt)) excel file or text file with a tab delimited text file. My User interface has: ...
9
by: NEWSGROUPS | last post by:
I have data in a table in an Access 2000 database that needs to be exported to a formatted text file. For instance, the first field is an account number that is formatted in the table as text and...
1
by: Wayne L | last post by:
I am trying to export a text file and before exporting I want to type the information to be inserted or select from a list. Is this possible?
1
by: Abhishek Bhatt | last post by:
Need to export table into csv file. Tried following: DoCmd.TransferText acExportDelim, "", TABLENAME, "C:\abc.csv", False, "" But the exported file contains data enclosed in double quotes i.e....
0
by: Hemant Pathak | last post by:
Hi All i m working in Vb 6.0 and Access 2000 i want to export Table or Query Source database to Destination Database
5
harshadd
by: harshadd | last post by:
can some one explain me, how to update foxpro table (.dbf file) using clien side coading in DHTML or ay client side code like java?
16
mikek12004
by: mikek12004 | last post by:
How to copy a table (with the data) from one server to another (the two servers are in different PCs)? Basically if I could move the data to a txt file inthe form of the insert command (like the...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.