Results 1 to 9 of 9
  1. #1
    test1000 is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Jun 2017
    Posts
    6

    Export to .csv file

    Hello,



    I'm using Microsoft Access 2010 and I want to do an export to a .csv file from a query.
    I can to do an export to .xlxs. So that works.
    But when I want to do an export to a .csv file than I get the message the "specname" file (this is the config how to do the export like no " and so one) doesn't exists.
    The weird thing is the this file exist in the database.
    I did right click and follow the steps. And the end I did 'save exportsteps'. I give it the name 'exporttocsv'.
    When I do the vba command docmd.transfertext acexportdelim, "exporttocsv", ........... (and the rest)
    Then I get the message : exporttocsv doesn't exist. But the file exist. If you do menu - extern data - save exportdata then I see the file.
    When I choose 'run' I got the file.

    So what went wrong ?

    I read on internet that since Access 2010 it isn't possible to do an export with the vba command.
    That you have to use the schema.ini file.
    Is that correct ?

    If yes, is there a script that can create the schema.ini automatically.

    Thanks and regards.

  2. #2
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    You need to create a specification file. To do this, do an export to text manually. When the window comes up, go to Advanced, it will ask you about the file and you need to save those specs with a name. That is the name to use for the specifications.

  3. #3
    test1000 is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Jun 2017
    Posts
    6
    Hello,

    That I did.
    This mean : right-click on the query - export - follow the steps and then at the end 'save the export' and I give it a name (name : exportcsv).
    I can see the export name when I do menu 'extern data - save exports'.
    In this screen I can chose for 'run' and I have a correct file.
    So far so good.

    But now : when I use the VBA code : docmd.transfertext acexportdelim, "exportcsv", ....... the I get the message "export file 'exportcsv' not found" !!!

    Somebody on the internet said that this is because in Access 2010 you can't use the docmd.transfertext with the specification file.
    That you have to use the schema.ini file.
    But how can you create the 'schema.ini' ?

    Or do you have other ideas ?

    Thx

  4. #4
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    I don't think you followed my instructions.
    follow the steps
    Did you click on Advanced during this?

  5. #5
    test1000 is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Jun 2017
    Posts
    6
    Click image for larger version. 

Name:	exportpuntkomma.png 
Views:	7 
Size:	29.5 KB 
ID:	29256

    See printscreen. I think the config is correct. The file is correct because I can do 'run' when I chose in menu - extern data - save exports.
    But the I do the docmd.transfer then I get the message "exportcsv" doesn't exists.

    So what else can i configure in the Advanced button ?

    Thx

  6. #6
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    In this window, when you click on the bottom button (Specificaties), is "exportcsv" listed as an existing spec file? That is the one it is asking for.

  7. #7
    test1000 is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Jun 2017
    Posts
    6
    Now I can this error :
    "The field separator character from the text file specification corresponds to the decimal or text separator"
    But as you can see in the previous printscreen the sign's are good.
    Other idea's why I get this message ?

    Thx

  8. #8
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    I don't think your translation is quite correct! I am going to guess that it is referring to the "Scheidingsteken veld" which for us is the field delimiter. I set mine to a semi-colon as you have it and a comma for the decimals and it exported without error. I wonder if you have any formatting on the table or query that is interfering with this? It may be a European issue?

  9. #9
    test1000 is offline Novice
    Windows 8 Access 2010 32bit
    Join Date
    Jun 2017
    Posts
    6
    Quote Originally Posted by aytee111 View Post
    I don't think your translation is quite correct! I am going to guess that it is referring to the "Scheidingsteken veld" which for us is the field delimiter. I set mine to a semi-colon as you have it and a comma for the decimals and it exported without error. I wonder if you have any formatting on the table or query that is interfering with this? It may be a European issue?

    Hello,
    But it works. I make a mistake.
    I forgot the " " around the specification file :-(

    I wrote : docmd.transfertext acExportdelim, exportcsv, ............ instead of : docmd.transfertext acExportdelim, "exportcsv", ............

    Thanks for your help.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 03-03-2017, 09:25 PM
  2. How can I export to xml file with a predefined xsd file?
    By lios in forum Import/Export Data
    Replies: 4
    Last Post: 07-02-2015, 11:47 PM
  3. Export Access table data to flat file (txt file)
    By edmscan in forum Import/Export Data
    Replies: 3
    Last Post: 06-17-2015, 12:03 PM
  4. Replies: 13
    Last Post: 12-12-2013, 07:22 PM
  5. How do you export a file with a unique file name
    By Budman42 in forum Import/Export Data
    Replies: 1
    Last Post: 10-15-2006, 06:10 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums