navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

Microsoft MVP

 

easy fix. Need to add OR IS NULL

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP and Database >> easy fix. Need to add OR IS NULL
Page: [1]
 
travismp

 

Posts: 215
Joined: 2/1/2002
From: hutchinson ks USA
Status: offline

 
easy fix. Need to add OR IS NULL - 5/6/2008 12:06:07   
AND [::Operator::]=Yes


How can I change this to add operator = YES or IsNull

I thought this would do it but it does not

AND ([::Operator::]=Yes OR IsNull(Operator))


what am I missing? It is a drop down box on a search form if it matters.
BeTheBall

 

Posts: 6271
Joined: 6/21/2002
From: West Point Utah USA
Status: offline

 
RE: easy fix. Need to add OR IS NULL - 5/6/2008 12:32:32   
Try this:

AND ([::Operator::]='Yes' OR [::Operator::]='')

_____________________________

Duane

Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.

(in reply to travismp)
travismp

 

Posts: 215
Joined: 2/1/2002
From: hutchinson ks USA
Status: offline

 
RE: easy fix. Need to add OR IS NULL - 5/6/2008 12:45:37   
Nope.

Database Results Error
Description: [Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression.
Number: -2147217913 (0x80040E07)
Source: Microsoft OLE DB Provider for ODBC Drivers

One or more form fields were empty. You should provide default values for all form fields that are used in the query.

(in reply to BeTheBall)
travismp

 

Posts: 215
Joined: 2/1/2002
From: hutchinson ks USA
Status: offline

 
RE: easy fix. Need to add OR IS NULL - 5/6/2008 12:48:20   
Here is my full line of code if it helps.

fp_sQry="SELECT * FROM tbl_MAIN WHERE (Contractors LIKE '::Contractors::%' AND City LIKE '%::City::%' AND State LIKE '%::State::%' And (PlanStatus LIKE '%::PlanStatus::%' OR IsNull(PlanStatus)) And (PlanStatus_SeaRiver LIKE '%::PlanStatus_SeaRiver::%' OR IsNull(PlanStatus_SeaRiver)) AND ([::Operator::]='Yes' OR [::Operator::]='')) ORDER BY Contractors ASC"

(in reply to travismp)
travismp

 

Posts: 215
Joined: 2/1/2002
From: hutchinson ks USA
Status: offline

 
RE: easy fix. Need to add OR IS NULL - 5/6/2008 12:54:47   
Also could it be something with my drop down as well? I have "Select One" as my top drop down with no value selected.

(in reply to travismp)
BeTheBall

 

Posts: 6271
Joined: 6/21/2002
From: West Point Utah USA
Status: offline

 
RE: easy fix. Need to add OR IS NULL - 5/6/2008 14:06:09   
Do you have a link? What does the full search form look like?

_____________________________

Duane

Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.

(in reply to travismp)
travismp

 

Posts: 215
Joined: 2/1/2002
From: hutchinson ks USA
Status: offline

 
RE: easy fix. Need to add OR IS NULL - 5/6/2008 14:10:19   
No it is behind a secure log in section. I can PM you the entire code... would that work or would that not work?

(in reply to BeTheBall)
BeTheBall

 

Posts: 6271
Joined: 6/21/2002
From: West Point Utah USA
Status: offline

 
RE: easy fix. Need to add OR IS NULL - 5/6/2008 15:37:55   
Explain a bit more about the field Operator. It is the name of the dropdown, not a field in the database?

_____________________________

Duane

Some people are like Slinkies . . . Not really good for anything . . . . . But they still bring a smile to your face when you push them down a flight of stairs.

(in reply to travismp)
travismp

 

Posts: 215
Joined: 2/1/2002
From: hutchinson ks USA
Status: offline

 
RE: easy fix. Need to add OR IS NULL - 5/6/2008 15:42:01   
Operator is the name of the drop down. There are currently 12 selections. Those 12 come from my DB. This allows them to search the different divisions for a more detailed view. I added a 13th option called "View All" which has a null value so if they want to search for all locations then they can just leave that as the default.

Operator is the name of the drop down control.

(in reply to BeTheBall)
Spooky

 

Posts: 26560
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: easy fix. Need to add OR IS NULL - 5/6/2008 16:25:53   
But "view all' cant be null?
The 'operator' drop down must supply a value as this is required as a column name in the SQL string.
To do a view all, you would need to eliminate that part of the search from the criteria if "view all" was selected

_____________________________

If you arent part of the solution, then there is good money to be made prolonging the problem

§þ:)


(in reply to travismp)
travismp

 

Posts: 215
Joined: 2/1/2002
From: hutchinson ks USA
Status: offline

 
RE: easy fix. Need to add OR IS NULL - 5/6/2008 16:42:16   
OK.

I wanted to add an option to "View All" and have no value assigned to it. So if they selected that it would technically be a null value. Sounds like my logic cannot be done. I guess my users will HAVE to select a division to see the results then. Thanks.

(in reply to Spooky)
DesiMcK

 

Posts: 407
Joined: 4/26/2004
From: Essex, UK
Status: offline

 
RE: easy fix. Need to add OR IS NULL - 5/6/2008 17:28:38   
Can you not have a several SQL statement for the View All scenario.

So rather than have
fp_sQry="SELECT * FROM tbl_MAIN WHERE (Contractors LIKE '::Contractors::%' AND City LIKE '%::City::%' AND State LIKE '%::State::%' And (PlanStatus LIKE '%::PlanStatus::%' OR IsNull(PlanStatus)) And (PlanStatus_SeaRiver LIKE '%::PlanStatus_SeaRiver::%' OR IsNull(PlanStatus_SeaRiver)) AND ([::Operator::]='Yes' OR [::Operator::]='')) ORDER BY Contractors ASC"

Try something like

if Request("PlanStatus") = 'All' Then
fp_sQry="SELECT * FROM tbl_MAIN WHERE (Contractors LIKE '::Contractors::%' AND City LIKE '%::City::%' AND State LIKE '%::State::%') And (PlanStatus_SeaRiver LIKE '%::PlanStatus_SeaRiver::%' OR IsNull(PlanStatus_SeaRiver)) AND ([::Operator::]='Yes' OR [::Operator::]='')) ORDER BY Contractors ASC"
End If

This why you can customise the sql WHERE clause.

Does this help?

Desi

(in reply to travismp)
Page:   [1]

All Forums >> Web Development >> ASP and Database >> easy fix. Need to add OR IS NULL
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts