473,387 Members | 1,540 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,387 software developers and data experts.

Access Insert - Syntax Error for field "DATE" but not for "DATE1"

objConn = New ADODB.Connection
objConn.Open("Provider=Microsoft.Jet.OLEDB.4.0;Dat a Source=" & dbPath _
& ";Jet OLEDB:Database Password=" & dbPassword)

This cause error: (VB.NET. )

sqlString = "insert into table1 " _
& "(Date1,Time,Ext,Co) values " _
& "('04/04/05','06:02PM','101','01');"

But below is fine

sqlString = "insert into table1 " _
& "(Date1,'Time1,Ext,Co) values " _
& "('04/04/05','06:02PM','101','01');"
That is , if I change the Access Table filed name
from "Date" -> Date1
"Time" -> "Time1". Then the above code run through fine.
But in my VB6 code before, I used the same TABLE Field Name and it works.
(That was a different VB project, of course)

Nov 21 '05 #1
2 4528
Try enclosing Date and Time inside Square Brackets [Date], [Time] as they
are reserved words.

Doug
"devprog" <de*****@nospam.nospam> wrote in message
news:OX**************@TK2MSFTNGP15.phx.gbl...
objConn = New ADODB.Connection
objConn.Open("Provider=Microsoft.Jet.OLEDB.4.0;Dat a Source=" & dbPath _
& ";Jet OLEDB:Database Password=" & dbPassword)

This cause error: (VB.NET. )

sqlString = "insert into table1 " _
& "(Date1,Time,Ext,Co) values " _
& "('04/04/05','06:02PM','101','01');"

But below is fine

sqlString = "insert into table1 " _
& "(Date1,'Time1,Ext,Co) values " _
& "('04/04/05','06:02PM','101','01');"
That is , if I change the Access Table filed name
from "Date" -> Date1
"Time" -> "Time1". Then the above code run through fine.
But in my VB6 code before, I used the same TABLE Field Name and it works.
(That was a different VB project, of course)

Nov 21 '05 #2
Hi Bell,

Thanks so much for the helping.

"Doug Bell" <du*@bigpond.com> wrote in message
news:ed**************@tk2msftngp13.phx.gbl...
Try enclosing Date and Time inside Square Brackets [Date], [Time] as they
are reserved words.

Doug
"devprog" <de*****@nospam.nospam> wrote in message
news:OX**************@TK2MSFTNGP15.phx.gbl...
objConn = New ADODB.Connection
objConn.Open("Provider=Microsoft.Jet.OLEDB.4.0;Dat a Source=" & dbPath _
& ";Jet OLEDB:Database Password=" & dbPassword)

This cause error: (VB.NET. )

sqlString = "insert into table1 " _
& "(Date1,Time,Ext,Co) values " _
& "('04/04/05','06:02PM','101','01');"

But below is fine

sqlString = "insert into table1 " _
& "(Date1,'Time1,Ext,Co) values " _
& "('04/04/05','06:02PM','101','01');"
That is , if I change the Access Table filed name
from "Date" -> Date1
"Time" -> "Time1". Then the above code run through fine.
But in my VB6 code before, I used the same TABLE Field Name and it works. (That was a different VB project, of course)


Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Jeremy | last post by:
I am relatively inexperienced with SQL, and I am trying to learn how to analyze some data with it. I have a table with the following information. COMPANY ID , DATE, MarektValue I would like...
2
by: Larry R Harrison Jr | last post by:
I have an Access 97 database with 2 tables that have a one-many relationship. I have a SQL statement in the "one" table which I want to execute and insert 7 records into the "many" table, and I...
3
by: | last post by:
Hello, I am hoping someone else has thought about a date time calculation i need to perform. I would like to be able to calculate the number of "working minutes" between 2 dates, given my...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.