473,395 Members | 1,742 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Help with debugging code for Access 2003

Hi have code below that enables a user to browse for data and import spreadsheet data. I keep receiving error message 3134 syntax error for "INSERT INTO" statement. Could someone please help me out? see bold below

Thanks

Expand|Select|Wrap|Line Numbers
  1. Private Sub btnImportData_Click()
  2.  
  3. Dim dlgPickFiles As Office.FileDialog
  4. Dim strFileName As String
  5.  
  6. Set dlgPickFiles = Application.FileDialog(msoFileDialogFilePicker)
  7.  
  8. With dlgPickFiles
  9.      .AllowMultiSelect = False
  10.      With .Filters
  11.         .Clear
  12.         .Add "Excel files", "*.xls"
  13.     End With
  14.       .Show
  15.       strFileName = .SelectedItems(1)
  16.       End With
  17.  
  18.     Set dlgPickFiles = Nothing
  19.  
  20.     With DoCmd
  21.         .TransferSpreadsheet acLink, acSpreadsheetTypeExcel9, _
  22.             "tblTempLink", strFileName, False, "Data Output!A2:C2"
  23.         .RunSQL "INSERT INTO TBL Import_Excel (Sponsor, Owner, Project_Name) " & _
  24.             "SELECT tblTempLink.Sponsor, tblTempLink.Owner, tblTempLink.Project_Name " & _
  25.             "FROM tblTempLink;"
  26.         .DeleteObject acTable, "tblTempLink"
  27.     End With
  28.  
  29. End Sub
Sep 28 '07 #1
4 1361
nico5038
3,080 Expert 2GB
Try:
Expand|Select|Wrap|Line Numbers
  1. INSERT INTO [TBL Import_Excel] (Sponsor, Owner, Project_Name)
The [ and ] are mandatory when you have a space in the name, guess you now know why I don't use spaces in (table/field) names :-)

Nic;o)
Sep 28 '07 #2
Thanks Nico,
but I am still getting that syntax error message. I even tried enclosing my field with brackets. I am totally lost.
Oct 1 '07 #3
nico5038
3,080 Expert 2GB
In a case like this I place a breakpoint (by clicking in the left ruler besides the assign statement.
Then trigger the code to run and when at the assign statement take the stringing part and type in the immediate window at the bottom a question mark followed by this code. Then by prssing [Enter] you get the entire build string.
Now copy/paste this string in a new query and try to execute that in the query editor. Now the cursor will be positioned on the error part.

Nic;o)
Oct 2 '07 #4
FishVal
2,653 Expert 2GB
Hi have code below that enables a user to browse for data and import spreadsheet data. I keep receiving error message 3134 syntax error for "INSERT INTO" statement. Could someone please help me out? see bold below

Thanks

Expand|Select|Wrap|Line Numbers
  1. Private Sub btnImportData_Click()
  2.  
  3. Dim dlgPickFiles As Office.FileDialog
  4. Dim strFileName As String
  5.  
  6. Set dlgPickFiles = Application.FileDialog(msoFileDialogFilePicker)
  7.  
  8. With dlgPickFiles
  9.      .AllowMultiSelect = False
  10.      With .Filters
  11.         .Clear
  12.         .Add "Excel files", "*.xls"
  13.     End With
  14.       .Show
  15.       strFileName = .SelectedItems(1)
  16.       End With
  17.  
  18.     Set dlgPickFiles = Nothing
  19.  
  20.     With DoCmd
  21.         .TransferSpreadsheet acLink, acSpreadsheetTypeExcel9, _
  22.             "tblTempLink", strFileName, False, "Data Output!A2:C2"
  23.         .RunSQL "INSERT INTO TBL Import_Excel (Sponsor, Owner, Project_Name) " & _
  24.             "SELECT tblTempLink.Sponsor, tblTempLink.Owner, tblTempLink.Project_Name " & _
  25.             "FROM tblTempLink;"
  26.         .DeleteObject acTable, "tblTempLink"
  27.     End With
  28.  
  29. End Sub
Hi, there. Your [tblTempLink] has default field names F1, F2, F3 as soon as you've linked it to XL file with HasFieldNames:=False.

Kind regards,
Fish
Oct 2 '07 #5

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

Similar topics

6
by: Ken Varn | last post by:
I am trying to remote debug a C# application but the debugger is reporting the following exception: An unhandled exception of type 'System.IO.FileLoadException' occurred in Unknown Module....
3
by: R Millman | last post by:
under ASP.NET, single stepping in debug mode appears not to stop within event procedures. i.e. 1) Create web page with submit button and event procedure for the click event in the code behind...
7
by: wh | last post by:
Can somebody confirm that you have to be in the Administrators group to be able to debug an ASP.NET application? Wayne.
5
by: Bruce Schechter | last post by:
I just started to develop an ASP.NET application in vs.net 2003 . But each time I try to execute the application (which is basically empty so far), I get a dialog box titled "Microsoft Development...
10
by: Shawn | last post by:
JIT Debugging failed with the following error: Access is denied. JIT Debugging was initiated by the following account 'PLISKEN\ASPNET' I get this messag in a dialog window when I try to open an...
15
by: DavidS | last post by:
Have Visual Studio.NET installed on MS 2000 Professional OS laptop. No issue ever with web development and SQL connections. Purchased new laptop with XP Professional SP2!!!!!!!! & Visual...
0
by: matsla | last post by:
I have followed all guide lines to set up remote debugging but is it possible to do cross-domain remote debugging? I use same account/password on both computers (XP => 2003), added users to debug...
5
by: Velvet | last post by:
Can someone tell me to what process I need to attach to be able to step through my classic ASP code in VS.net 2003. I'm working on an XP box with IIS installed. I also have VS.net 2005 (The...
1
by: Chris Raudabaugh | last post by:
Error Msg: Error while trying to run project: Unable to start debugging on the web server. Access is denied. After many hours of scanning MS KB's, newsgroups, and msdn trying all of the...
3
by: =?Utf-8?B?UGF1bA==?= | last post by:
Hi I have both vs 2003 and vs 2005 runing on a machine that has windows xp on it with iis 5.1. Everything works except I can not debug a 2003 web application. I looked in IIS and it is using...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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
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
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,...
0
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
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...
0
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
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,...

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.