473,549 Members | 2,583 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Invalid SQL statement stemming from filename

33 New Member
I have a file named:
Exec MIS Report.csv

When I attempt to import this into Access 2003, I recieve an error , "Invalid SQL statement; expected 'DELETE', 'INSERT', 'PROCEDURE', 'SELECT', or 'UPDATE'."

I renamed the file to:
Executive MIS Report.csv

And now the file imports without a hitch. Is Exec a reserved word? Is Exec part of SQL?

Thank you!

-Kyle
May 20 '09 #1
6 4842
ADezii
8,834 Recognized Expert Expert
@servantofone
EXEC[UTE] is a Transact-SQL Reserved word which will execute a User Defined Function, a System Procedure, or a User-Defined Stored Procedure but I'm not sure if it has a bearing on your situation. Just for curiosity, have you tried Importing ExecMIS Report.csv without the Space?
May 21 '09 #2
servantofone
33 New Member
Just tried that... and Access imports it correctly. It only occurrs when the file is named Exec with a space after it. I have never experienced anything like this before. You can import the CSV file into Excel with the first filename, but Access will not. Well, I guess it doesn't really matter... I'll just use a different filename. Thanks for the info!
May 21 '09 #3
NeoPa
32,564 Recognized Expert Moderator MVP
If you post in your actual code we can give a more precise answer without any guesswork.

I think you can assume that Exec is reserved though.
May 25 '09 #4
servantofone
33 New Member
NeoPa,

I'm not using any code. I'm right-clicking in the database window, selecting import for the menu, and then choosing a file that has Exec within the filename. This causes Access to generate the error prior to the wizard popping up.

-Kyle
May 26 '09 #5
NeoPa
32,564 Recognized Expert Moderator MVP
Ah. I see.

I think this indicates a glitch in the Access code. Almost certainly related to a special case of "Exec ..." In the circumstances I can only suggest to avoid using it.
May 26 '09 #6
ADezii
8,834 Recognized Expert Expert
@servantofone
It took me a little while, but I did come up with what may be a workable solution, the 'Base Code' of which I'll post for you. Basically, if the Filename contains 'Exec ' it is converted and Renamed to 'Exec_', the Import occurs without any problems, and the User is notified of this process. If the Filename does not contain 'Exec ', it is Imported normally. It is up to you as to whether or not it is a viable Option:
Expand|Select|Wrap|Line Numbers
  1. Public Function fImportCSVFile(strFileName As String)
  2. Dim strNewName As String
  3.  
  4. If InStr(strFileName, "Exec ") > 0 Then     'does "Exec " appear in the File Name
  5.   strNewName = Replace(strFileName, "Exec ", "Exec_")
  6.     Name strFileName As strNewName      'Rename the File replqacing Exec  with Exec_
  7.       DoCmd.TransferText acImportDelim, , "CSV Table", strNewName, False
  8.       MsgBox strFileName & " has been Renamed to " & strNewName & " in order to avoid " & _
  9.                            "Import Errors", vbExclamation, "Change in File name"
  10. Else
  11.   DoCmd.TransferText acImportDelim, , "CSV Table", strFileName, False
  12. End If
  13. End Function
To successfully Import a File with 'Exec ' contained within its Name:
Expand|Select|Wrap|Line Numbers
  1. Debug.Print fImportCSVFile("C:\Dezii\Exec Test.csv")
May 26 '09 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

2
2184
by: Richard Hyett | last post by:
I dug out a PHP version of Porters Algorithm from :-http://www.tartarus.org/~martin/PorterStemmer/php.txt Whenever I try and run it I'm getting the error "Wrong parameter count for join() " Can anyone guess what I am doing wrong, I haven't modified the class so I assume its the way I'm calling it. Richard
1
10431
by: Fraser S | last post by:
Hi, I am receiving an invalid mail Attachment error when trying to send an attachment using System.Web.Mail. I have read other posts on these errors and have since checked that the asp.net account has permissions to access the file and of course that it is there. I am also running the program on the same machine that the file is stored. I...
3
2462
by: Narine | last post by:
Hi All, I need to write one complicated update statement and I'm looking at maybe finding a simpler way to do it. I have 2 tables: 1.Photo Table PhotoID FileName 1 111.jpg
5
2419
by: Steve Drake | last post by:
All, I am trying to open a word document and get all the properties using .NET (c#), if I create the wordapp, call the correct methods I get invalid cast (see code examples), but if I create a WORD PROJECT (from C#) and use the Application (thisApplication) the word project creates, it works fine, but this is far from a acceptable work...
2
2886
by: Xam | last post by:
Hello everybody Do you know of a javascript routine that can warn if there are any pre-defined invalid chars in the filename of an INPUT file box before it is submitted with the submit button. The process would be: a) User clicks the INPUT File's Browse button to select the file from their computer.
2
5209
by: Rubycon | last post by:
Hi all, can anybody tell me what he invalid parameter is in this code. When I try to execute the mmioDescendParent I get a returncode 11, meaning that an invalid parameter has been passed. I just don't know which one and therefor not how to improve my code. Regards, Rubycon
5
6852
by: jason.neo | last post by:
Hi all experts, I am going nuts with this Invalid postback or callback argument thingy with .Net 2.0 I am building a file attachment module which relays on a Datatable stored in session (yeah i know its unhealthy, but its the only "clean" approach which I can think of to avoid tranfering temp files onto the server) to maintain the list...
0
1607
eboyjr14
by: eboyjr14 | last post by:
I have this xml metacity thing, and it is giving off this error: The file format is invalid. <?xml version="1.0"?> <metacity_theme> <info> <name>Royale</name> <author>Devin Samarin</author> <copyright>Devin Samarin, 2007</copyright>
2
1390
by: mk | last post by:
Hello, I'm trying to learn how with statement can be used to avoid writing: prepare() try: something_that_can_raise_SomeException() except SomeException, err: deal_with_SomeException finally:
0
7459
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7726
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7485
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7819
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5377
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3505
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3488
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1953
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1064
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.