"Invalid Argument" error when VBA exporting to text a multivalued field (1 Viewer)

world33

Registered User.
Local time
Today, 14:41
Joined
Oct 24, 2006
Messages
21
Hello,
I have a VBA module that export to CSV text and works perfectly on any table except for those that contain a multivalued field.

PHP:
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 fine (commas are replaced by semicolons within the multivalued field) but the module for some reason does not digest multivalued fields. Can anybody enlighten me?

Thanks
 

vbaInet

AWF VIP
Local time
Today, 05:41
Joined
Jan 22, 2010
Messages
26,374
You will find that multivalued fields are not portable with SQL Server or other commercial sql databases. It's an Access only feature. But I think it works in Sharepoint Server.

However, take out the last argument and I think it would solve your problem:
Code:
DoCmd.TransferText acExportDelim, "Export Specification", "Table 01", "D:\Table 01.txt", True
 

world33

Registered User.
Local time
Today, 14:41
Joined
Oct 24, 2006
Messages
21
You will find that multivalued fields are not portable with SQL Server or other commercial sql databases. It's an Access only feature. But I think it works in Sharepoint Server.

However, take out the last argument and I think it would solve your problem:
Code:
DoCmd.TransferText acExportDelim, "Export Specification", "Table 01", "D:\Table 01.txt", True

Thanks for the reply. I tried
PHP:
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

but it still gives me the "invalid argument" error
 

vbaInet

AWF VIP
Local time
Today, 05:41
Joined
Jan 22, 2010
Messages
26,374
Check your export spec. You may have not included that field in there. Create a new export spec and include the field.
 

Users who are viewing this thread

Top Bottom