Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2006
    Posts
    5

    Unanswered: Invalid Argument error when exporting to text a multivalued field with a VBA module

    Hello,

    I use a VBA module that export to CSV text and works perfectly on any table except for those that contain multivalued fields.

    PHP Code:
    Function Export_to_text_delimited()
    On Error GoTo Export_to_text_delimited_Err

    DoCmd
    .TransferText acExportDelim"Export Specification""Table 01""D:\Table 01.txt"True""

    Export_to_text_delimited_Exit:
        Exit Function

    Export_to_text_delimited_Err:
        
    MsgBox Error$
        
    Resume Export_to_text_delimited_Exit

    End 
    Function 
    The error I get is "invalid argument". If I export from the ribbon menu it is working properly (commas are replaced by semicolons within the multivalued field) but the VBA module, for some reason, does not digest multivalued fields. Can anybody enlighten me?

    Thanks

  2. #2
    Join Date
    Feb 2004
    Location
    Chicago, IL
    Posts
    1,312
    Do you need it to export to Comma Separated file? I had no idea what a multivalued field was, thanks for the link. I would suggest changing the delimiter to another character to see if it works.

    To change the delimiter to anything you want (I will use the | pipe character on occasion) try exporting your table manually. When the export wizard appears click the Advanced button. Choose your export spec and then change the Field Delimiter to anything you want . You can type any character in the field. Then save you spec and try your code again.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •