Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8823683
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T06:25:12+00:00 2026-06-14T06:25:12+00:00

I have an access database which manipulates data from a Magento e-commerce store, reformats

  • 0

I have an access database which manipulates data from a Magento e-commerce store, reformats the data and (hopefully!) spits out a CSV file which can then be imported into ebay Turbolister for mass upload to eBay.

I have got as far as creating a query which correctly lays out the data into the format required by Turbolister.

My issues are various (including some which appear to be related to Access’ handling of large field contents), however the crux of my problem is that I am struggling to get working a simple script which exports the query results as a properly formatted CSV (including doubling up on double quotes where required inside a text value i.e. if the value itself contains quotes which need to be retained).

The DoCmd.TransferText solution throws an error related to field size (‘the field is too small to accept the amount of data you attempted to add’) so thats no good.

Has anyone got a good working CSV export routine in VBA that they can suggest?

Cheers

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T06:25:13+00:00Added an answer on June 14, 2026 at 6:25 am

    This is an old function I sometimes used to use, it allows you to specify the delimeter, it also checks the data it’s outputting and if it can’t be evaluated to either a date or a numeric etc, then it uses double quotes:

    Public Function ExportTextDelimited(strQueryName As String, strDelimiter As String)
    
    Dim rs          As Recordset
    Dim strHead     As String
    Dim strData     As String
    Dim inti        As Integer
    Dim intFile     As Integer
    Dim fso         As New FileSystemObject
    
    On Error GoTo Handle_Err
    
        fso.CreateTextFile ("C:\Untitled.csv")
    
        Set rs = Currentdb.OpenRecordset(strQueryName)
    
        rs.MoveFirst
    
        intFile = FreeFile
        strHead = ""
    
        'Add the Headers
        For inti = 0 To rs.Fields.Count - 1
            If strHead = "" Then
                strHead = rs.Fields(inti).Name
            Else
                strHead = strHead & strDelimiter & rs.Fields(inti).Name
            End If
        Next
    
        Open "C:\Untitled.csv" For Output As #intFile
    
        Print #intFile, strHead
    
        strHead = ""
    
        'Add the Data
        While Not rs.EOF
    
            For inti = 0 To rs.Fields.Count - 1
                If strData = "" Then
                    strData = IIf(IsNumeric(rs.Fields(inti).value), rs.Fields(inti).value, IIf(IsDate(rs.Fields(inti).value), rs.Fields(inti).value, """" & rs.Fields(inti).value & """"))
                Else
                    strData = strData & strDelimiter & IIf(IsNumeric(rs.Fields(inti).value), rs.Fields(inti).value, IIf(IsDate(rs.Fields(inti).value), rs.Fields(inti).value, """" & rs.Fields(inti).value & """"))
                End If
            Next
    
            Print #intFile, strData
    
            strData = ""
    
            rs.MoveNext
        Wend
    
            Close #intFile
    
    rs.Close
    Set rs = Nothing
    
    'Open the file for viewing
    Application.FollowHyperlink "C:\Untitled.csv"   
    
    Exit Function
    
    Handle_Err:
    MsgBox Err & " - " & Err.Description
    
    End Function
    

    It may need a couple of tweaks as I’ve taken out some bits which were only relevant to my particular case but this may be a starting point.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have selected a bunch of data from my access database which one of
I have a database connection which takes an input from the querystring to access
I have an (access) database table which contains data I would like to populate
We have a local server with an access database which feeds data to clients
I have an Access database which is split, and have moved it from the
Problem: I have an address field from an Access database which has been converted
In an application we are developing, I have access to a database table which
I have this old Access database (2000 format) which i want to convert to
I have an Access application which use SQLServer 2008 R2 as database. When I
I have a local Database running on localhost:3306, which I access with MySQL Workbench.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.