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

Why is this Data Mismatch ??? =(

=( what is wrong with this...
when i run the query it says "data type mismatch in criteria expression"...


Field
aprid: Sum(([prem]+[eprem_o]+[eprem_m])*1*IIf((Not ([code]=[rcode]) And Not ([rcode]=("TOPUP" Or "FSB" Or "FSSB" Or "MKB"))) And ([status]="I" Or ([status]="P" And Not (IsEmpty([edate])))),1,0))
Total
Expression

Field
apTU: Sum(([prem]+[eprem_o]+[eprem_m])*1*IIf([rcode]=("TOPUP" Or "FSB" Or "FSSB" Or "MKB") And ([status]="I" Or ([status]="P" And Not (IsEmpty([edate])))),1,0))
Total
Expression

Thank you!!
Nov 27 '08 #1
2 1464
Whenever I get this error it's usually because I've tried linking a text field to a number field or something similar.
Without knowing more info about your table and/or query I can't help.

Could you post the (relevant) field names and types?
Nov 27 '08 #2
Stewart Ross
2,545 Expert Mod 2GB
An OR has to work on an expression it can evaluate to True or False.

Your current ORs try to OR string literal values to the statement preceding - not what you meant to write, but that is its effect. This approach, of writing

a OR b OR c OR d

could only work if the values a..d being ORd this way are of boolean type (True/False values), not strings. Hence the type mismatch error.

Personally, I think your approach is so complicated (with far too many comparisons and conditions) I'd rethink this one from scratch. However, if you want to at least fix the syntax errors your ORs should be along these lines:

Expand|Select|Wrap|Line Numbers
  1. ... And Not (([rcode]="TOPUP") Or ([rcode]="FSB") Or ([rcode]="FSSB") ...
-Stewart
Nov 27 '08 #3

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

Similar topics

1
by: Mo | last post by:
The following select statement is givign me a 'data type mismatch' message and I don't really know why. strSQL = "SELECT CN" strSQL = strSQL & " FROM tblDeaths" strSQL = strSQL & " WHERE CN = ...
1
by: amitbadgi | last post by:
I am getting the following error while converting an asp application to asp.net Exception Details: System.Runtime.InteropServices.COMException: Data type mismatch in criteria expression. ...
1
by: lalbee | last post by:
I am trying to use the Dcount function but receive a data type mismatch error, can someone help me determine the cause? Count: DCount("","qry-final everhome results"," <'0' ") Thanks!
2
by: zoro25 | last post by:
Hi, I'm pretty sure it's a no brainer for some people, but I'm lost... I have a form that I use to filter on a report on Access 2000. I use various criterias in list boxes to filter my report...
5
by: isoquin | last post by:
The below code throws the error: "Data type mismatch in criteria expression" Searching online didn't seem to offer me a solution. Public Sub update_by_EDD(myDate As Date, myMR As String) ...
3
Kermit
by: Kermit | last post by:
Hi. Here's the problem. I use C# application to access MSAccess database. I want to get id's of all records containing some phrase and order results by date (a field in the table). here's 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...
3
by: Bruce Lawrence | last post by:
I've got a form that when it opens it prompts the user for 2 peices of information. The Asset and the Date. getasset = InputBox("Enter the Asset Number") If getasset = "" Then Exit Sub Else...
2
by: shivasusan | last post by:
Hi! when i pass the data to my database MS-Access. i got error. Error Type: Microsoft JET Database Engine (0x80040E07) Data type mismatch in criteria expression....
0
by: chanlichin | last post by:
Select Case (cbMonth.Text) Case "January" Dates = "1" Case "February" Dates = "2" Case "March"
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: 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...
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: 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
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.