473,387 Members | 1,844 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.

Run-Time error -2147217900(80040e14) Syntax error in INSERT INTO statement

Hiiii I am making my project in VB6.0 and my back end is Access 2003. I hav one problem.....
When I going to save data into database, at at cmdSave_Click event, VB giving me error(Error mentioned at heading)after clicking on SAVE button and Highlighting the statement which are as follows.....

rs.Open "Insert into addclasses (Batch, BatchTime, Std, CollYear, SchlBtchName, CollBtchName, BatchType, SchlSubjct ,CollSubjct, Teacher, Days, LecDate, StartTime, AM/PM1, EndTime, AM/PM2) values ("& cboBtch.Tag & ", " & cboBtchTime.Tag & ", " & cboStd.Tag & ", " & cboYear.Tag & ", " & cboBtchNoSchl.Tag & ", " & cboBtchNoColl & ", " & cboBtchType.Tag & ", " & cboTeacher.Tag & ", '" & txtDays.Text & "', #" & DTPicker1.Value & "#, '" & txtStrtTime.Text & "', " & cboTime1.Tag & ", '" & txtEndTime.Text & "', " & cboTime2 & ")", con, adOpenDynamic, adLockOptimistic

Expand|Select|Wrap|Line Numbers
  1. (inside Module)
  2.  
  3. Option Explicit
  4. Public con As ADODB.Connection
  5. Public rs As ADODB.Recordset
  6.  
  7.  
  8. Public Function conn()
  9. Set con = New ADODB.Connection
  10. con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\CCMS.mdb;Persist Security Info=False"
  11.  
  12. con.Open "CCMS.mdb"
  13. End Function
  14.  
  15. Public Function reco()
  16. Set rs = New ADODB.Recordset
  17. End Function
  18.  
Expand|Select|Wrap|Line Numbers
  1. (in actual form's code window)
  2. Private Sub cmdSave_Click()
  3. If rs.State = 1 Then rs.Close
  4. Call reco 
  5.  
  6. rs.Open "Insert into addclasses (Batch, BatchTime, Std, CollYear, SchlBtchName, CollBtchName, BatchType, SchlSubjct ,CollSubjct, Teacher, Days, LecDate,StartTime, AM/PM1, EndTime, AM/PM2) values (" & cboBtch.Tag & ", " & cboBtchTime.Tag & ", " & cboStd.Tag & ", " & cboYear.Tag & ", " & cboBtchNoSchl.Tag & ", " & cboBtchNoColl & ", " & cboBtchType.Tag & ", " & cboTeacher.Tag & ", '" & txtDays.Text & "', #" & DT1.Value & "#, '" & txtStrtTime.Text & "', " & cboTime1.Tag & ", '" & txtEndTime.Text & "', " &cboTime2 & ")", con, adOpenDynamic, adLockOptimistic
  7.  
  8. Call cleaner(Me)     'Cleaning all textboxes and comboboxes.
  9. MsgBox "Successfuly Save!!", vbInformation, "CCMS"
  10.  
  11.  
  12.  
Mar 1 '11 #1

✓ answered by debasisdas

Try renaming the following columns in the database table and re-execute the code.

1. AM/PM1
2. AM/PM2

2 6164
debasisdas
8,127 Expert 4TB
Try renaming the following columns in the database table and re-execute the code.

1. AM/PM1
2. AM/PM2
Mar 2 '11 #2
Very Very Thanx a lot debasisdas..... now my code is working........
Mar 2 '11 #3

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

Similar topics

3
by: Balaji | last post by:
I'm trying to do some basic socket programming. here is the line of code which is creating problem.. int FAR PASCAL __declspec (dllexport)(char * addr,int port) Hers is the error I'm...
2
by: kalpana.sinduria | last post by:
Hi all, how to remove the following complle error. When I compiling the code I get the following errors: Compiling... CDrtEachDefFeat.cpp d:\ include\common\cdrtintegfeat.h(39) : error...
0
by: MWK | last post by:
Hi All, I don't understand why I get "error c2061: syntax error : identifier" in VS2003. I thought it's fixed in .Net 2003: __hook(&TCP_Client::LineReceived, client, HandlerLineReceived); ...
1
by: IceColdFire | last post by:
I have a VC++.net Win32 console application, however when I compile , I get this error error C2146: syntax error : missing ';' before identifier 'Length' Explain... Location pointed is ...
1
by: parveen.beniwal | last post by:
hi all i am having the following line of code in my mak file. !IF "$(CFG)" == "" CFG=DesktopCommon - Win32 Release !MESSAGE No configuration specified. Defaulting to DesktopCommon -...
6
by: Pixel.to.life | last post by:
So I have this perfectly fine and running app, that uses managed C++ forms. Problem#1: I pass a Bitmap reference to a class, hoping to modify it in one of the class's methods, so it...
6
by: muby | last post by:
Hi everybody :) I'm modifying a C++ code in VC++ 2005 my code snippet void BandwidthAllocationScheduler::insert( Message* msg, BOOL* QueueIsFull,
4
by: srinathvs | last post by:
Hi, I have an access db that I am trying to query from a vb6 program. I've the following code: Dim sSQLQuery As String sSQLQuery = "SELECT * FROM TblData WHERE ID = " & Chr(39) & ID &...
2
shashahayes
by: shashahayes | last post by:
I am getting an error on this line, does anyone have any suggestions? here is the error here is line 25 if area > 750 then charge = 200 1>Furniture.cpp
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...

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.