473,795 Members | 2,667 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

objConn = New ADODB.Connectio n
objConn.Open("P rovider=Microso ft.Jet.OLEDB.4. 0;Data Source=" & dbPath _
& ";Jet OLEDB:Database Password=" & dbPassword)

This cause error: (VB.NET. )

sqlString = "insert into table1 " _
& "(Date1,Time,Ex t,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 4553
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******** ******@TK2MSFTN GP15.phx.gbl...
objConn = New ADODB.Connectio n
objConn.Open("P rovider=Microso ft.Jet.OLEDB.4. 0;Data Source=" & dbPath _
& ";Jet OLEDB:Database Password=" & dbPassword)

This cause error: (VB.NET. )

sqlString = "insert into table1 " _
& "(Date1,Time,Ex t,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.co m> wrote in message
news:ed******** ******@tk2msftn gp13.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******** ******@TK2MSFTN GP15.phx.gbl...
objConn = New ADODB.Connectio n
objConn.Open("P rovider=Microso ft.Jet.OLEDB.4. 0;Data Source=" & dbPath _
& ";Jet OLEDB:Database Password=" & dbPassword)

This cause error: (VB.NET. )

sqlString = "insert into table1 " _
& "(Date1,Time,Ex t,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
2113
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 to select the largest 100 marketvalues for each date in my table. How can I do this efficiently in MySql.
2
3423
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 want them to be linked to the "main" table. Problem is, it won't let me run the SQL run as long as the one-many relationship is established in the relationship window. The SQL is:
3
3123
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 working week definition. Lets say I have a working week definition of Monday through Friday, 9 am to 5 pm. Date1 = January 1st, 2005 at 8 am
0
9519
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10436
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10213
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7538
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5436
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5563
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4113
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
2
3722
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2920
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.