Runitime error '3131' Syntax error in FROM clause in MS Access 2016 DoCmd.RunSQL Statement

Hashiru

Active Member
Joined
May 29, 2011
Messages
286
Hello All, I am having errors with this line of code:

DoCmd.RunSQL "SELECT FAIN, Scope, ALI, Project, [Resource ID],[System Source],Voucher,Vendor,[Vendor Name],[RMB Amount],[UTL Amount],Type INTO CurrentData FROM [Text;DATABASE=C:\Users\C033732\Desktop\CSVFolderPivotTable;HDR=Yes].FFR Query 20180914.csv"

Thanks in advance.
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
One thing to try is taking the spaces out of the filename (FFR Query 20180914.csv -- FFR_Query_20180914.csv). That should make everything considerably easier.

If that works then you've already found the problem.
 
Upvote 0
Thanks for the quick response, the file is coming from a system that I do not control and the import will be done by other employee so that will be a problem
 
Last edited:
Upvote 0
I would recommend you still change the filename to test if that is the problem. Then you can work out how to deal with spaces in the filename if that is the problem.
 
Upvote 0
yeah, I get a bunch of files from other sources too
and before I import them I always make a copy of the file and rename the new file by replacing spaces with underlines
 
Upvote 0
Never had to include a data source string in a sql statement, so just askin;
isn't the lack of quotes around the path when the path contains spaces a problem? Would

[Text;DATABASE='C:\Users\C033732\Desktop\CSVFolderPivotTable;HDR=Yes].FFR Query 20180914.csv'

fix the problem?
 
Upvote 0

Forum statistics

Threads
1,224,828
Messages
6,181,215
Members
453,024
Latest member
Wingit77

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top