473,831 Members | 2,311 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

5 New Member
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.T ag & ", " & cboBtchNoColl & ", " & cboBtchType.Tag & ", " & cboTeacher.Tag & ", '" & txtDays.Text & "', #" & DTPicker1.Value & "#, '" & txtStrtTime.Tex t & "', " & cboTime1.Tag & ", '" & txtEndTime.Text & "', " & cboTime2 & ")", con, adOpenDynamic, adLockOptimisti c

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
2 6200
debasisdas
8,127 Recognized Expert Expert
Try renaming the following columns in the database table and re-execute the code.

1. AM/PM1
2. AM/PM2
Mar 2 '11 #2
rahul more
5 New Member
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
5534
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 getting.. error C2059: syntax error : '('
2
10928
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 C2143: syntax error : missing ';' before '*'
0
1949
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); System::Void HandlerLineReceived(TCP_Client* sender, String* Data)
1
4160
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 typedef struct _LIST
1
4372
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 - Win32 Release.
6
2985
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 reflects outside too. Something like this:
6
38088
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
11697
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 & Chr(39) ID here is equal to 1234567890 MsgBox sSQLQuery the msgbox says: SELECT * FROM TblData WHERE ID = '1234567890 Note that the quotation is missing at the end Set rs = db.OpenRecordset(sSQLQuery, dbOpenDynaset)
2
3972
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
9793
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9642
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
10777
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...
1
10534
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9317
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7748
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
5620
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...
2
3964
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3076
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.