Solved

ERROR: 2147217913

Posted on 2004-04-07
3
399 Views
Last Modified: 2013-12-25
I get the error datatype mismatch in criteria expression with my Insert query, which is as follows:

SQLInsert = "insert into Participation([Term Code], [Course Code], [Player ID])"
                 SQLInsert = SQLInsert & " values('" & frm_input.MsData.TextMatrix(frm_input.MsData.Row, 8) & "', '" & frm_input.MsData.TextMatrix(frm_input.MsData.Row, 9) & "', '" & frm_input.MsData.TextMatrix(frm_input.MsData.Row, 10) & "')"
                 objConn.Execute SQLInsert

in the immediate window, this is what ?SQLInsert gives;

insert into Participation([Term Code], [Course Code], [Player ID]) values('1910', 'AU2004', 'CU1358')

Which works fine in MsAccess, which is my back-end.

I have checked datatype in acess and its all good, also the exact query works on a different program for the same databse.

Please help!!!!
0
Comment
Question by:claracruz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 8

Expert Comment

by:bramsquad
ID: 10778748
are you sure your SQL query is correct?   this would be the format i would use


INSERT INTO Participation
SELECT
FROM YourTable
WHERE (((YourTable.[Term Code])='1910') AND ((YourTable.[Course Code])='AU2004') AND ((YourTable.[Player ID])='CU1358'));

~b

0
 
LVL 8

Expert Comment

by:bramsquad
ID: 10778759
nevermind what i just put, i read that q incorrect.......brb
0
 
LVL 18

Accepted Solution

by:
Sethi earned 500 total points
ID: 10780205
Type mismatch smpley points to the fact that you are inserting a string in a numeric column. Please check whether any of the columns is a numeric data type. Assuming that [Term Code] is a numeric one then this is how the query should look:
insert into Participation([Term Code], [Course Code], [Player ID]) values(1910, 'AU2004', 'CU1358')

You have to remove the single quotes from your SQL statement:

SQLInsert = "insert into Participation([Term Code], [Course Code], [Player ID])"
                 SQLInsert = SQLInsert & " values(" & frm_input.MsData.TextMatrix(frm_input.MsData.Row, 8) & ", '" & frm_input.MsData.TextMatrix(frm_input.MsData.Row, 9) & "', '" & frm_input.MsData.TextMatrix(frm_input.MsData.Row, 10) & "')"
                 objConn.Execute SQLInsert


0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question