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 criteria, the Mid
function returns the values when I run the query. So if one of the
values is a "t" (no quotes), can I not ask to isolate that record by
putting "t" as a criteria? Nope - error, error.
If I put it within the expression itself (adding ="t") at the end, the
query returns T or F values (0 or -1). Ok, so can't I again isolate
the -1 (True) value here by putting -1 in the criteria. Again,
apparently not.
Should this not be a simple matter - what am I missing?
Any help is greatly appreciated. Thanks!
Martin Lacoste
P.S. Here is the code if it helps at all. It works as it should when I
remove the ="t" criteria, but I was to filter out records with such a
criteria, which I cannot.
SELECT Mid([Incipit],InStr(1,[Incipit],[WrongCase]),[LengthWrong]) AS
WrongWord, [New Index].CantusIDNumber , [New Index].Incipit,
InStr(1,[Incipit],[WrongCase]) AS [Position],
Mid([Incipit],(InStr([Incipit],[WrongCase])-1),1) AS [SpaceBefore?],
Asc(Left(Mid([Incipit],InStr(1,[Incipit],[WrongCase]),[LengthWrong]),1))
AS [Ascii Value of Wrong Character], InStr([Incipit],[Ignore1]) AS
[Exception]
FROM tblSpellingErro rs, [New Index]
WHERE (((InStr(1,[Incipit],[WrongCase]))>1) AND
((Mid([Incipit],(InStr([Incipit],[WrongCase])-1),1))="t") AND
((InStr([Incipit],[Ignore1]))=1 Or (InStr([Incipit],[Ignore1]))=0))
ORDER BY Mid([Incipit],InStr(1,[Incipit],[WrongCase]),[LengthWrong]),
[New Index].CantusIDNumber ; 3 6499
BTW - using Access2000.
Martin
BTW - using Access2000
Martin
<ma*******@roge rs.com> wrote in message
news:11******** **************@ o13g2000cwo.goo glegroups.com 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 criteria, the Mid function returns the values when I run the query. So if one of the values is a "t" (no quotes), can I not ask to isolate that record by putting "t" as a criteria? Nope - error, error.
If I put it within the expression itself (adding ="t") at the end, the query returns T or F values (0 or -1). Ok, so can't I again isolate the -1 (True) value here by putting -1 in the criteria. Again, apparently not.
Should this not be a simple matter - what am I missing?
Any help is greatly appreciated. Thanks! Martin Lacoste
P.S. Here is the code if it helps at all. It works as it should when I remove the ="t" criteria, but I was to filter out records with such a criteria, which I cannot.
SELECT Mid([Incipit],InStr(1,[Incipit],[WrongCase]),[LengthWrong]) AS WrongWord, [New Index].CantusIDNumber , [New Index].Incipit, InStr(1,[Incipit],[WrongCase]) AS [Position], Mid([Incipit],(InStr([Incipit],[WrongCase])-1),1) AS [SpaceBefore?],
Asc(Left(Mid([Incipit],InStr(1,[Incipit],[WrongCase]),[LengthWrong]),1)) AS [Ascii Value of Wrong Character], InStr([Incipit],[Ignore1]) AS [Exception] FROM tblSpellingErro rs, [New Index] WHERE (((InStr(1,[Incipit],[WrongCase]))>1) AND ((Mid([Incipit],(InStr([Incipit],[WrongCase])-1),1))="t") AND ((InStr([Incipit],[Ignore1]))=1 Or (InStr([Incipit],[Ignore1]))=0)) ORDER BY Mid([Incipit],InStr(1,[Incipit],[WrongCase]),[LengthWrong]), [New Index].CantusIDNumber ;
From what you describe, I suspect that the calculation or the comparison
returns an error for one or more records, but that the error-producing
calculation is not actually performed until it has to be -- this is what
Jet usually does when a a query calls a function, to save time. When
you apply a criterion to the field, though, the calculation has to be
evaluated for all records right up front.
This is just speculation, but I would check all records for values of
Incipit and WrongCase such that Incipit doesn't contain WrongCase, or
contains it starting at the first position in the string. Either of
those situations, it seems to me, will give an error. I don't *think*
Null in either of those fields would raise an error, but that may be
worth checking for, too.
--
Dirk Goldgar, MS Access MVP www.datagnostics.com
(please reply to the newsgroup) This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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 results
should return information on either a single employee or all
employees.
the problem that i have is that if i type in "*" (but without quotes)
in the QBE criteria, it works fine. however, if i use Iif() to
determine whether or not there...
|
by: deko |
last post by:
Okay, so I figured out how to pull Outlook Appointments into an Access Table
(see below).
But the data comes in the wrong Data Type - how do I convert it from Text to
Long Integer?
For example, If I have a custom Form in Outlook with and "Entity_ID" field,
this number will come into the table as text - and every time I try to do
something with it, I get "data type mismatch".
|
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 that will run fine without any criteria but as soon as I
add any criteria it gives a "Data type mismatch" error.
As soon as I remove any criteria it runs perfectly.
I know this query is based on another query but I have other processes
based on...
|
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 was once a type Number,
but I had to change it to a type Text due to I needed to have two zeros
at the beginning of the Asset Number (EX: 001234.)
The rease I am writing is that now when I run from My Query Menu a
|
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. "Tasks.Name" is a "Text" field with
description of task, while "DurationHrs" is a VB function that
calculates number of hours between two "DateTime" values and returns
| |
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. "Tasks.Name" is a "Text" field with
description of task, while "DurationHrs" is a VB function that
calculates number of hours between two "DateTime" values and returns
|
by: DBQueen |
last post by:
I have a database where the user will have the opportunity to set up a
number of Tests. I want the user to be able to enter the equation if a
field for a particular test is to be a calculated value. This will be
entered into tblTests. There are 4 data fields in tblSamples (Data1,
Data2, Data3, Data4). When setting up a new test the user will fill in the
equation for any caluclated data fields into fields Calc1, Calc2, Calc3,
Calc4 in...
|
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.
--------------------------------------------------------------------------------
Data type mismatch in criteria expression.
|
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 date is more than 10 months out.
The query runs fine, but I when I put the criteria of >10 I get 'Data Type mismatch' error. The code below is the original query. I have since put all the datediff bit in code, with all variables declared as date,...
|
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...
|
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...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |