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

using boolean as criteria in SQL

In my SQL I have a column that returns a boolean value (-1 or 0), no
problem.

I need to be able to only see the records that return a 0 (False). I
can sort and bring these to the top.

When I attempt to create a criteria on the QBE or filter (right click
menu), I am confronted with a ""This expression is typed incorrectly,
or is too complex to be evaluated"" error.

I have tried filtering on "0", "False", "Not True", "<>-1", ".-1", all
with the same error.

What am I doing wrong?

- Daron

May 10 '06 #1
7 25691
you should be able to use True or False (without quotes).

May 10 '06 #2
Daron wrote:
In my SQL I have a column that returns a boolean value (-1 or 0), no
problem.

I need to be able to only see the records that return a 0 (False). I
can sort and bring these to the top.

When I attempt to create a criteria on the QBE or filter (right click
menu), I am confronted with a ""This expression is typed incorrectly,
or is too complex to be evaluated"" error.

I have tried filtering on "0", "False", "Not True", "<>-1", ".-1", all
with the same error.

What am I doing wrong?

- Daron

May we assume you aren't entering the values like "False" with quotes?

In the table, is the field Yes/No? Is it numeric? Is it a returned
value from a function? Are you linking multiple tables in the query?
If your query isn't too complex (iow lengthy with lots of joins), you
might want to post it here.

If this is coming from multiple tables, create a query with just that
table, a couple of fields and the true/false field and filter on it.
Does that work OK?
This is from help
(Error 3071)
Possible causes:

· You typed an expression that has invalid syntax. For example, an
operand or operator may be missing, you may have typed an invalid
character or comma, or you may have typed text without enclosing it with
quotation marks ( " ). Check the expression to make sure you typed it
correctly.
· You typed an expression that is too complex. For example, a numeric
expression may contain too many complicated elements. Try simplifying
the expression by assigning some parts to variables.
From the above, I suggest we are missing some information to help you.
May 11 '06 #3
Thanks for taking the time to help!

Lets start with the sQL, and go from there:

SELECT Eval("[Forms]![frm_Setup]![lbo_CurrentFields].[Column](1)") AS
[Current Field], quni_Master.STU_DISTRICT_CODE,
quni_Master.STU_STUDENT_ID,
Eval("[Forms]![frm_Setup]![lbo_CurrentFields].[Column](2)") AS ErrWarn,

Eval("[Forms]![frm_Setup]![lbo_CurrentFields].[Column](0)") AS
TestField,
quni_Master.STU_DATE_OF_ENTRY_GRADE_9 AS [Current Value],
[Forms]![frm_Setup]![sub_FieldValidation].[Form]![mem_Error] AS
strReason,
fun_CheckDateFormat([STU_DATE_OF_ENTRY_GRADE_9])
FROM quni_Master
WHERE (((quni_Master.STU_DATE_OF_ENTRY_GRADE_9) Is Not Null) AND
((fun_CheckDateFormat([STU_DATE_OF_ENTRY_GRADE_9]))=False));

(Additional info: The quotes where included in the original post only
for this message, not used in the SQL. The final SQL that is run has an
INSERT clause to create an error report.)

What I am doing is using Access to validate text files before they are
passed on to an Oracle data warehouse. All fields are being treated as
text for validation purposes.

In these files, the date fields must have a specific format
(YYYY-MM-DD), so I have a function, fun_CheckDateFormat(), that checks
this format, and returns a boolean. True is a correct format and a
valid date, False is not.

The query works fine without the final WHERE clause to show only False
responses. I can see the column listing 0's and -1's. As soon as I
include that criteria, I get the error message "This expression is
typed incorrectly, or is too complex to be evaluated".

As you can see, this is a fairly straight forward SQL.

The question I have is: how do show only the False records? How does
this one additional test make this expression "too complex"?

May 11 '06 #4
Thanks for taking the time to help!

Lets start with the SQL, and go from there:

SELECT Eval("[Forms]![frm_Setup]![lbo_CurrentFields].[Column](1)") AS
[Current Field], quni_Master.STU_DISTRICT_CODE,
quni_Master.STU_STUDENT_ID,
Eval("[Forms]![frm_Setup]![lbo_CurrentFields].[Column](2)") AS ErrWarn,
Eval("[Forms]![frm_Setup]![lbo_CurrentFields].[Column](0)") AS
TestField,
quni_Master.STU_DATE_OF_ENTRY_GRADE_9 AS [Current Value],
[Forms]![frm_Setup]![sub_FieldValidation].[Form]![mem_Error] AS
strReason,
fun_CheckDateFormat([STU_DATE_OF_ENTRY_GRADE_9])
FROM quni_Master
WHERE (((quni_Master.STU_DATE_OF_ENTRY_GRADE_9) Is Not Null) AND
((fun_CheckDateFormat([STU_DATE_OF_ENTRY_GRADE_9]))=False));

(Additional info: The quotes where included in the original post only
for this message, not used in the SQL. The final SQL that is run has an
INSERT clause to create an error report.)

What I am doing is using Access to validate text files before they are
passed on to an Oracle data warehouse. All fields are being treated as
text for validation purposes.

In these files, the date fields must have a specific format
(YYYY-MM-DD), so I have a function, fun_CheckDateFormat(), that checks
this format, and returns a boolean. True is a correct format and a
valid date, False is not.

The query works fine without the final WHERE clause to show only False
responses. I can see the column listing 0's and -1's. As soon as I
include that criteria, I get the error message "This expression is
typed incorrectly, or is too complex to be evaluated".

As you can see, this is a fairly straight forward SQL.

The question I have is: how do show only the False records? How does
this one additional test make this expression "too complex"?

May 11 '06 #5
Daron wrote:
Thanks for taking the time to help!

Lets start with the sQL, and go from there:

SELECT Eval("[Forms]![frm_Setup]![lbo_CurrentFields].[Column](1)") AS
[Current Field], quni_Master.STU_DISTRICT_CODE,
quni_Master.STU_STUDENT_ID,
Eval("[Forms]![frm_Setup]![lbo_CurrentFields].[Column](2)") AS ErrWarn,

Eval("[Forms]![frm_Setup]![lbo_CurrentFields].[Column](0)") AS
TestField,
quni_Master.STU_DATE_OF_ENTRY_GRADE_9 AS [Current Value],
[Forms]![frm_Setup]![sub_FieldValidation].[Form]![mem_Error] AS
strReason,
fun_CheckDateFormat([STU_DATE_OF_ENTRY_GRADE_9])
FROM quni_Master
WHERE (((quni_Master.STU_DATE_OF_ENTRY_GRADE_9) Is Not Null) AND
((fun_CheckDateFormat([STU_DATE_OF_ENTRY_GRADE_9]))=False));

(Additional info: The quotes where included in the original post only
for this message, not used in the SQL. The final SQL that is run has an
INSERT clause to create an error report.)

What I am doing is using Access to validate text files before they are
passed on to an Oracle data warehouse. All fields are being treated as
text for validation purposes.

In these files, the date fields must have a specific format
(YYYY-MM-DD), so I have a function, fun_CheckDateFormat(), that checks
this format, and returns a boolean. True is a correct format and a
valid date, False is not.

The query works fine without the final WHERE clause to show only False
responses. I can see the column listing 0's and -1's. As soon as I
include that criteria, I get the error message "This expression is
typed incorrectly, or is too complex to be evaluated".

As you can see, this is a fairly straight forward SQL.

The question I have is: how do show only the False records? How does
this one additional test make this expression "too complex"?

It's hard to say without seeing your function. When you pass the date
to the function, does the function take the date as a variant? It
should, since the date field could be null.

Public Function fun_CheckDateFormat(varDate As Variant) As Boolean

What happens if you did
WHERE fun_CheckDateFormat([STU_DATE_OF_ENTRY_GRADE_9])=False;
instead?

You will have to check for the date being null in your function.

I hope it's as simple as that.
May 11 '06 #6
Salad,

Your my saviour! (Not really, you can't replace Christ :) )

My function was taking the date as a string, not a variant. Changing it
as you suggested, plus explicitly testing for Null and setting the
return as False for the null values did the trick.

Now my curiosity is piqued. In my example I was filtering out the
records with a Null value, so these should never have been sent to my
fun_CheckDateFormat() function. Any ideas as to why I was getting the
error?

- Daron

May 11 '06 #7
"Daron" <Da**********@gmail.com> wrote in
news:11**********************@y43g2000cwc.googlegr oups.com:
Salad,

Your my saviour! (Not really, you can't replace Christ :) )

My function was taking the date as a string, not a variant.
Changing it as you suggested, plus explicitly testing for Null
and setting the return as False for the null values did the
trick.

Now my curiosity is piqued. In my example I was filtering out
the records with a Null value, so these should never have been
sent to my fun_CheckDateFormat() function. Any ideas as to why
I was getting the error?

- Daron


WHERE (((quni_Master.STU_DATE_OF_ENTRY_GRADE_9) Is Not Null) AND
((fun_CheckDateFormat([STU_DATE_OF_ENTRY_GRADE_9]))=False));

evaluates to Where True AND #ERROR, so throws up the message you
reported, which is not at all helpful.

SQL needs to evaluate both conditions. It has no way of knowing
that the second condition is dependent on the first. You could
write something like

WHERE firstname is not null And isMale = false

in which the two parts are independent of each other.

With your modified function you can drop the first part of your
where clause

--
Bob Quintal

PA is y I've altered my email address.
May 11 '06 #8

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

Similar topics

12
by: Salad | last post by:
I have a strange one that's making me scratch my head. The app is written in AccessXP. The table is a FoxPro 2.6 table. I link to it via ODBC. There is a field called Active, type Logical...
5
by: ShyGuy | last post by:
I have a form with about 20 option buttons. In some instances, when the form is opened, only 1 option button is enabled and the others are disabled. This is controlled by criteria from another...
4
by: C White | last post by:
Hi I am having problems with running a query that does the following there are 5 fields in a table that the query is based on, the first four are simple enough and all that happens is that the...
4
by: JH | last post by:
Fairly new to c# so please forgive any simple oversights. I'm developing a console app that loads dll assemblies at run time. The app scans a "plugin" directory for these dlls. Each dll is loaded...
2
by: ChasW | last post by:
I just read these 2 pages. These are most helpful, but leave me with a question. http://www.mvps.org/access/queries/qry0005.htm http://www.mvps.org/access/forms/frm0007.htm I have a Multi...
6
by: bjaj | last post by:
Hi How do I use a boolean criterian with the funktion DLookup ? I know the syntax for strings, numeric and date as follows For numerical values: DLookup("FieldName" , "TableName" ,...
7
by: ApexData | last post by:
Hello I currently Link the FE/BE using the LinkTables Option and the Linked Table Manager. Any time I need to move the BE to another location, I have to go through this process over again. I...
7
by: bryant | last post by:
Hi all. I am new to ASP and working in Expression Web. The following query displays the information I need in the gridview for a single record. SELECT "OE_HDR"."ORD_NO", "OE_HDR"."CUST_NAM",...
270
by: Jordan | last post by:
Hi everyone, I'm a big Python fan who used to be involved semi regularly in comp.lang.python (lots of lurking, occasional posting) but kind of trailed off a bit. I just wrote a frustration...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
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
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...
0
tracyyun
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.