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

Data type mismatch in criteria statement

I get a data type mismatch in the criteria statement error when the INSERT runs. The DELETE seems to working fine. All fields are text.

If someone could straighten me out, I'd really appreciate it.

[HTML]Private Sub blnSelect_AfterUpdate()

Dim strSql As String
Dim txtMR_ExID As String
Dim txtEx_180_ID As String
strMR_ExID = Me.Parent.txtMR_ExID
strEx180_ID = Me.txtEx180_ID

DoCmd.SetWarnings (True)
If Me.blnSelected Then
strSql = "INSERT INTO tblMR_ExHist ( [MR_ExID], [Ex180_ID] )" & _
"SELECT tblMR_Ex.[MR_ExID], tblEx180.[Ex180_ID] " & _
"FROM tblMR_Ex INNER JOIN tblEx180 ON (tblMR_Ex.Tail = tblEx180.Tail) AND (tblMR_Ex.ATA = tblEx180.ATA)" & _
"WHERE tblMR_Ex.[MR_ExID]= " & strMR_ExID & " AND " & _
"tblEx180.[Ex180_ID]= " & strEx180_ID
Else
strSql = "DELETE tblMR_ExHist.[MR_ExID], tblMR_ExHist.[Ex180_ID]" & _
"FROM tblMR_ExHist " & _
"WHERE tblMR_ExHist.[MR_ExID]= " & strMR_ExID & " AND " & _
"tblMR_ExHist.[Ex180_ID]= " & strEx180_ID
End If
DoCmd.RunSQL (strSql)
Debug.Print strSql
DoCmd.SetWarnings (True)

End Sub
[/HTML]

Thanks for any help!!!

Mike
Mar 15 '07 #1
1 1595
Denburt
1,356 Expert 1GB
Well according to the following statement you made "All fields are text." I would be led to believe that your variable strEx180_ID is a string and the field .[Ex180_ID] is also a string? If so then the SQL should look more like the following:

strSql = "DELETE tblMR_ExHist.[MR_ExID], tblMR_ExHist.[Ex180_ID]" & _
"FROM tblMR_ExHist " & _
"WHERE tblMR_ExHist.[MR_ExID]= " & strMR_ExID & " AND " & _
"tblMR_ExHist.[Ex180_ID]= '" & strEx180_ID & "'"

Otherwise if your field [Ex180_ID] is a number then the SQL statement looks OK just check and make sure that the variable is declared with the same type of number i.e. long, integer etc.
Mar 15 '07 #2

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

Similar topics

7
by: Jack | last post by:
Hi, I am trying to test a sql statement in Access which gives me the error as stated in the heading. The sql statement is built as a part of asp login verification, where the userid and password...
3
by: Laurel | last post by:
this is driving me crazy. i need to use a form control as a criteria in a select query, and the control's value is set depending upon what a user selects in an option group on the form. the query...
2
by: Chicken Kebab Abdullah | last post by:
Does anyone know why I get the error 3464 Data type mismatch from the following code. I have a form with a combo(to choose a consumable) and 2 list boxes on it. list on left is all printers...
0
by: news.paradise.net.nz | last post by:
I have been developing access databases for over 5 years. I have a large database and I have struck this problem with it before but can find nothing in help or online. Access 2000 I have a query...
2
by: psychomad | last post by:
Please, can someone help me out to solve this error, i've been searching throughout my codes and yet i didnt succeed in finding the error!!!! The Error is: Server Error in '/' Application....
15
by: sara | last post by:
I have a Memo field in a table to hold notes from a conversation a social worker has had with a client (this is for a non-profit). If the user needs to update the memo field, I need to find the...
19
by: Lysander | last post by:
I have written a query that takes three integers representing day,month and year, forms a date from them and compares this date to the date the record was entered and returns any records where the...
2
by: irkahs | last post by:
Dear friends, I am connecting an ASP page to an Access table. The table in Access has a field called orderNo which is of type "Number". Now...what I want to do is design an SQL...
9
by: nixonmg | last post by:
When the Command Button "Notify" is clicked, I am wanting to send out an email to the user with appropriate information in the email (works great), check the "Notified" check box (does not work), and...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: 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...

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.