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

Conditon in Query

SELECT SBCD.[Client Name], SBCD.[SRF#], SBCD.[Product Code],
SBCD.[AM#], SBCD.[Resp Transit], SBCD.[Existing Amount], SBCD.[Amount
Request], [Existing Amount]+[Amount Request] AS [Total Request],
SBCD.[Gate Date], SBCD.[Gate Time], SBCD.[Opening Date Finish],
SBCD.[Opening Time Finish], SBCD.[Opener Initial], SBCD.[Lending Date
Finish], SBCD.[Lending Time Finish], [Gate Date] & " " & [Gate Time] AS
[G Date], [Opening Date Finish] & " " & [Opening Time Finish] AS [OF
Date], [Lending Date Finish] & " " & [Lending Time Finish] AS [LF
Date], IIf([Lending Date Finish] Is Not Null,IIf(DateDiff("n",[G
Date],[LF Date])>0,1,0),0) AS Decision
FROM SBCD
WHERE (((SBCD.[Product Code])="I" Or (SBCD.[Product Code])="N") AND
((SBCD.[Gate Date]) Is Not Null) AND ((SBCD.[Gate Time]) Is Not Null)
AND ((SBCD.[Opening Date Finish])>Now()-7));

For above query, how can I display records with condition "Decision =
0"? I always get the "type mismatch" message when I use "0" as criteria
under "decision".

Nov 13 '05 #1
8 1444
th**********@rbc.com wrote:
For above query, how can I display records with condition "Decision =
0"? I always get the "type mismatch" message when I use "0" as criteria
under "decision".


Is the 'Decision' field a number or text data type? If it's a text type
then enclose the 0 in quotation marks:

Decision = "0"

HTH - Keith.
www.keithwilby.com
Nov 13 '05 #2
> SELECT SBCD.[Client Name], SBCD.[SRF#], SBCD.[Product Code],
SBCD.[AM#], SBCD.[Resp Transit], SBCD.[Existing Amount], SBCD.[Amount
Request], [Existing Amount]+[Amount Request] AS [Total Request],
SBCD.[Gate Date], SBCD.[Gate Time], SBCD.[Opening Date Finish],
SBCD.[Opening Time Finish], SBCD.[Opener Initial], SBCD.[Lending Date
Finish], SBCD.[Lending Time Finish], [Gate Date] & " " & [Gate Time] AS
[G Date], [Opening Date Finish] & " " & [Opening Time Finish] AS [OF
Date], [Lending Date Finish] & " " & [Lending Time Finish] AS [LF
Date], IIf([Lending Date Finish] Is Not Null,IIf(DateDiff("n",[G
Date],[LF Date])>0,1,0),0) AS Decision
FROM SBCD
WHERE (((SBCD.[Product Code])="I" Or (SBCD.[Product Code])="N") AND
((SBCD.[Gate Date]) Is Not Null) AND ((SBCD.[Gate Time]) Is Not Null)
AND ((SBCD.[Opening Date Finish])>Now()-7));

For above query, how can I display records with condition "Decision =
0"? I always get the "type mismatch" message when I use "0" as criteria
under "decision".


What you could do is use another query - select * from qryThisQry where
Decision = 0
Nov 13 '05 #3

Keith wrote:
th**********@rbc.com wrote:
For above query, how can I display records with condition "Decision = 0"? I always get the "type mismatch" message when I use "0" as criteria under "decision".
Is the 'Decision' field a number or text data type? If it's a text

type then enclose the 0 in quotation marks:

Decision = "0"

HTH - Keith.
www.keithwilby.com


Doesn't matter what data type I set to, I still receive the same error
message.

Nov 13 '05 #4
IIf([Lending Date Finish] Is Not Null,IIf(DateDiff("n",[G
Date],[LF Date])>0,1,0),0) AS Decision
There is a condition clause in parameter "Decision"

Nov 13 '05 #5
> There is a condition clause in parameter "Decision"

does that make a difference with a second, separate query that selects from
the first?
Nov 13 '05 #6
Why not use > 0 it works for me, anything in the field greater than 0
returns a list of those meeting the criteria.

Hope this helps

Kind regards, Gordon.

--------------------------------------------------------------------
"deko" <www.clearpointsystems.com@use_contact_form.com> wrote in message
news:rI*****************@newssvr13.news.prodigy.co m...
There is a condition clause in parameter "Decision"


does that make a difference with a second, separate query that selects
from
the first?

Nov 13 '05 #7
Sorry folks, I read the post the wrong way round, Doh!

Kind regards, Gordon.

--------------------------------------------------------------------------

"Gordon Youd" <go****@Zgyoud.demon.co.uk> wrote in message
news:cr*******************@news.demon.co.uk...
Why not use > 0 it works for me, anything in the field greater than 0
returns a list of those meeting the criteria.

Hope this helps

Kind regards, Gordon.

--------------------------------------------------------------------
"deko" <www.clearpointsystems.com@use_contact_form.com> wrote in message
news:rI*****************@newssvr13.news.prodigy.co m...
There is a condition clause in parameter "Decision"


does that make a difference with a second, separate query that selects
from
the first?


Nov 13 '05 #8
> There is a condition clause in parameter "Decision"

IMHO, I think you're overboard on the immediate if statements. I'd split it
in two for that reason alone
Nov 13 '05 #9

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

Similar topics

2
by: jaysonsch | last post by:
Hello! I am having some problems with a database query that I am trying to do. I am trying to develop a way to search a database for an entry and then edit the existing values. Upon submit, the...
29
by: shank | last post by:
1) I'm getting this error: Syntax error (missing operator) in query expression on the below statement. Can I get some advice. 2) I searched ASPFAQ and came up blank. Where can find the "rules"...
9
by: netpurpose | last post by:
I need to extract data from this table to find the lowest prices of each product as of today. The product will be listed/grouped by the name only, discarding the product code - I use...
3
by: Harvey | last post by:
Hi, I try to write an asp query form that lets client search any text-string and display all pages in my web server that contain the text. I have IIS 6.0 on a server 2003. The MSDN site says...
4
by: Diamondback | last post by:
I have two tables, WIDGETS and VERSIONS. The WIDGETS table has descriptive information about the widgets while the VERSIONS table contains IDs relating to different iterations of those widgets...
14
by: Dave Thomas | last post by:
If I have a table set up like this: Name | VARCHAR Email | VARCHAR Age | TINYINT | NULL (Default: NULL) And I want the user to enter his or her name, email, and age - but AGE is optional. ...
2
by: Dom | last post by:
I need to run a query based on a query in Access. The second query has a number of conditions which all work well, but there is one more contition I need to set to make it run properly. the...
5
by: Ryan Hubbard | last post by:
Is it possible to get the recordset from an open query window? So you run the query. The window is open. Can vba retrieve this data?
0
by: starace | last post by:
I have designed a form that has 5 different list boxes where the selections within each are used as criteria in building a dynamic query. Some boxes are set for multiple selections but these list...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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
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...
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.