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

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
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,223,911
Messages
6,175,334
Members
452,636
Latest member
laura12345

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