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 tblSpellingErrors, [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 6465
BTW - using Access2000.
Martin
BTW - using Access2000
Martin
<ma*******@rogers.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.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 tblSpellingErrors, [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...
|
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...
|
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...
|
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...
|
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....
|
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....
|
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...
|
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....
|
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...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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,...
|
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...
|
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,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
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...
| |