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 - Private Sub btnImportData_Click()
-
-
Dim dlgPickFiles As Office.FileDialog
-
Dim strFileName As String
-
-
Set dlgPickFiles = Application.FileDialog(msoFileDialogFilePicker)
-
-
With dlgPickFiles
-
.AllowMultiSelect = False
-
With .Filters
-
.Clear
-
.Add "Excel files", "*.xls"
-
End With
-
.Show
-
strFileName = .SelectedItems(1)
-
End With
-
-
Set dlgPickFiles = Nothing
-
-
With DoCmd
-
.TransferSpreadsheet acLink, acSpreadsheetTypeExcel9, _
-
"tblTempLink", strFileName, False, "Data Output!A2:C2"
-
.RunSQL "INSERT INTO TBL Import_Excel (Sponsor, Owner, Project_Name) " & _
-
"SELECT tblTempLink.Sponsor, tblTempLink.Owner, tblTempLink.Project_Name " & _
-
"FROM tblTempLink;"
-
.DeleteObject acTable, "tblTempLink"
-
End With
-
-
End Sub
4 1361
Try: - 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)
Thanks Nico,
but I am still getting that syntax error message. I even tried enclosing my field with brackets. I am totally lost.
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)
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 - Private Sub btnImportData_Click()
-
-
Dim dlgPickFiles As Office.FileDialog
-
Dim strFileName As String
-
-
Set dlgPickFiles = Application.FileDialog(msoFileDialogFilePicker)
-
-
With dlgPickFiles
-
.AllowMultiSelect = False
-
With .Filters
-
.Clear
-
.Add "Excel files", "*.xls"
-
End With
-
.Show
-
strFileName = .SelectedItems(1)
-
End With
-
-
Set dlgPickFiles = Nothing
-
-
With DoCmd
-
.TransferSpreadsheet acLink, acSpreadsheetTypeExcel9, _
-
"tblTempLink", strFileName, False, "Data Output!A2:C2"
-
.RunSQL "INSERT INTO TBL Import_Excel (Sponsor, Owner, Project_Name) " & _
-
"SELECT tblTempLink.Sponsor, tblTempLink.Owner, tblTempLink.Project_Name " & _
-
"FROM tblTempLink;"
-
.DeleteObject acTable, "tblTempLink"
-
End With
-
-
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
Sign in to post your reply or Sign up for a free account.
Similar topics
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....
|
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...
|
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.
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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,...
|
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...
|
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,...
|
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...
|
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...
|
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...
|
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,...
| |