473,484 Members | 1,638 Online
Bytes | Software Development & Data Engineering Community
Create 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 4827
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,556 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,556 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
2178
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() " ...
1
10418
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...
3
2451
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
2409
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...
2
2870
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. ...
2
5197
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...
5
6845
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...
0
1599
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...
2
1387
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...
0
7082
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6953
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...
0
7144
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7214
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...
0
5407
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4845
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...
0
3046
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...
1
592
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
235
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.