473,320 Members | 2,189 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,320 software developers and data experts.

'Data Type Mismatch In Criteria expression' Error



Hi everyone

Hope someone can help with this one..

Background:

I work in vehicle fleet, I have built something to 'predict' when a
car/van service is due (it's fairly simple, calculates miles per day
between 2 known dates/mileages and then uses the service schedule to
work out what date the next service would be due, selecting the 'closer'
of 2 calculated dates, one is based on miles, one based on time).

It also calculates when the vehicles annual UK MOT (vehicle
roadworthiness) test is due and if it's within a month of the service,
ties the 2 events together.

After calculations are complete a new table is output and that is used
for subsequent reporting. The new table is overwritten each time the
calculations query is run.

Problem:

Anyway I built it for a single clients data and it worked. I have now
tried to add another client by appending their data and when the
calculation/output query runs I get the following error

'Data Type Mismatch In Criteria expression'

I thought it was because I maybe had a text field in the import that
should be a number, something like that, but copying the structure of
the main table to a temporary one and importing data to that didn't show
up any errors.

Also, the error does not always happen at the same point in the query. I
have managed to output the file with as little as 300 records appended
before the error, or as many as 600 (and points in between). If I work
in small(ish) batches to append, I seem to get further.

I thought I had a (vague) memory that date calculations can cause this
error (and I have quite a few of those), but I'm no Access expert and am
stuck for an answer.

Any help gratefully received.

Thanks in advance.

Bob
Aug 31 '06 #1
4 35467
Bob,
the background info is helpful, but we need more info. Are you running
a query? Could you post the SQL for it? What are the field types
involved in the joins and the where clause? Maybe they don't match and
Access isn't coercing them... So make sure they're of the right same on
both sides of the join. If you're using Autonumber on one side, the
other side would be a Long Integer.

Aug 31 '06 #2

Thanks for responding to my question.

The SQL is attached. I'm no expert so it's probably over complicated,
but it did work for the first 800 vehicles for one client. (BTW I use
the query builder, I'm not good enough to write raw SQL)

I just turned the make-table back into a select query, to check it that
way, and it still crashes.

Can you give me a pointer on the fundamental area of the problem? Does
that error message categorically mean that the new (additional) data I'm
using has an error? Or could it be a red herring and there's something
wrong in the way I've written the query?

Thanks

Bob



n message <11*********************@74g2000cwt.googlegroups.c om>,
pi********@hotmail.com writes
>Bob,
the background info is helpful, but we need more info. Are you running
a query? Could you post the SQL for it? What are the field types
involved in the joins and the where clause? Maybe they don't match and
Access isn't coercing them... So make sure they're of the right same on
both sides of the join. If you're using Autonumber on one side, the
other side would be a Long Integer.

Sep 1 '06 #3

A bit more info.

I actually deleted the source data from the db tables, merged the 2
sets of client data and reformatted them using Excel, so I had one big
vehicle file and one big history file.
Both files were formatted in line with the db field spec's (ie long
dates for dates, numbers for numbers etc).

I then re-imported the data into the empty tables in the db

The error message still occurs when the query is run.
As the db was kind of 'thrown together' at short notice but did partly
achieve it's aim for today's deadline, I think I'm going for a
re-design, it's probably quicker than trying to find the fault.

I'm still curious as to why the error occurs though

Thanks for your help.
Sep 1 '06 #4


Guys, thanks for taking the trouble to read this and try and assist me.

I found it..

Believe it or not, it was something really daft and the error message in
Access didn't really indicate the underlying fault.

There was 1 record where the 'last known mileage date' should have been
02/09/04 and it was 09/02/04 (2nd Sept instead of 9th Feb).

It caused the 'calculated miles per day' to come out as a negative and
blew-up a calculation that used miles per day to work out something
else.

I'm not sure how that's a 'data type mismatch' but hey, at least it's
fixed.

Thanks to all for reading and trying to assist.
Bob
Sep 1 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: ArcadeJr | last post by:
Good morning all! I have been getting a Run-time Error message #3464 - Data Type mismatch in criteria expression. While trying to run a query. I have a database where the field Asset_Number...
3
by: martlaco1 | last post by:
Trying to fix a query that (I thought) had worked once upon a time, and I keep getting a Data Type Mismatch error whenever I enter any criteria for an expression using a Mid function. Without the...
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. ...
2
by: igor.barbaric | last post by:
Hello! I have created a very simple query like this: SELECT Tasks.Name, DurationHrs(,) AS Duration FROM Tasks INNER JOIN Log ON Tasks.TaskID=Log.TaskID; The above query works fine....
10
by: aaronrm | last post by:
I have a real simple cross-tab query that I am trying to sum on as the action but I am getting the "data type mismatch criteria expression" error. About three queries up the food chain from this...
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....
5
by: blackburnj55 | last post by:
Hi, I am constructing a website for a bike shop. I am using dreamweaver and an access database to create it. I have made a query where two criteria are entered to get results. These are :...
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...
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...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
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: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

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.