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

"Catch all"

Hi,

Is there any criteria I can use in my where clause to say 'anything'? Maybe
like the _ used in some languages?

For my example, I want to use an inline-if, so if a checkbox is ticked I say
where field=true, otherwise just let everything pass through.

For checkboxes I know I can used iif(xxx,true,(true or false)) but I also
wish to use strings, where iif(xxx,yyy,'*') doesn't work - as the search on
'*' doesn't pick up null values that I'd want to keep hold of in outer join
situations..

Hope that makes sense!
Cheers,
Chris


Nov 12 '05 #1
3 2118
"Not Me" <No****@faker.fake.fa.ke> wrote in message
news:c0**********@ucsnew1.ncl.ac.uk...
Hi,

Is there any criteria I can use in my where clause to say 'anything'? Maybe like the _ used in some languages?

For my example, I want to use an inline-if, so if a checkbox is ticked I say where field=true, otherwise just let everything pass through.

For checkboxes I know I can used iif(xxx,true,(true or false)) but I also
wish to use strings, where iif(xxx,yyy,'*') doesn't work - as the search on '*' doesn't pick up null values that I'd want to keep hold of in outer join situations..


Note i've tried 'true' but that doesn't seem to have the effect I wish (it's
a bit like '*' in that the null values don't show up...)

Cheers,
Chris
Nov 12 '05 #2
Not Me wrote:
Hi,

Is there any criteria I can use in my where clause to say 'anything'? Maybe
like the _ used in some languages?

For my example, I want to use an inline-if, so if a checkbox is ticked I say
where field=true, otherwise just let everything pass through.

For checkboxes I know I can used iif(xxx,true,(true or false)) but I also
wish to use strings, where iif(xxx,yyy,'*') doesn't work - as the search on
'*' doesn't pick up null values that I'd want to keep hold of in outer join
situations..


try as criteria line

Is Null or Like '*'

--
Bas Cost Budde
http://www.heuveltop.org/BasCB
but the domain is nl

Nov 12 '05 #3
Not Me wrote:
Hi,

Is there any criteria I can use in my where clause to say 'anything'? Maybe
like the _ used in some languages?

For my example, I want to use an inline-if, so if a checkbox is ticked I say
where field=true, otherwise just let everything pass through.

For checkboxes I know I can used iif(xxx,true,(true or false)) but I also
wish to use strings, where iif(xxx,yyy,'*') doesn't work - as the search on
'*' doesn't pick up null values that I'd want to keep hold of in outer join
situations..


Let's say you have a form with gobs of combo boxes, option groups, date fields,
etc that will define the filter for a report. You have a command button to
print/preview the report. I usually have a routine to create the filter and a
routine to create a string that deines the filter that is placed in the report
header so the user can take the report and see how the results were arrived at.
Ex:
Dim strWhere As String
Dim strWhereString As String

strWhere = MakeFilter()
Me.WhereSTring = MakeFilterString

Docmd.OpenReport "MyReport",,,strWhere
,,,,

Private Function MakeFilter()
Dim strWhere As String
If Not Isnull(Me.DateFld) Then strWhere = "DateFld = #" & Me.DateFld & "#
And "
If Me.ComboBox > 0 then strWhere = strWhere & "Status = " & Me.ComboBox & "
And "
etc
If strWhere > "" Then MakeFilter = Left(strWhere,len(strWhere)-5) 'remove
And
end function

Private Function MakeFilterString()
Dim strWhere As String
If Not Isnull(Me.DateFld) Then strWhere = "Date Field: " & Me.DateFld &
space(5)
'etc.
MakeFilter = strWhereString

end function

In the report header I create a field with the control source
Forms!ReportFilterForm!WhereString
and it will display the verbose filter created. Prints 1 time only on page.

The filter only displays records that met a criteria in MakeFilter().

The bottom line, filter those that meet a criteria. If you want to include them
all (ex, filter on True, if not true, select ALL) then why bother adding it to
the filter?
If Checkbox = True then strWhere = "[YesNoField] = True And "
If null or false, why add it to the filter?
Nov 12 '05 #4

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

Similar topics

3
by: lwoods | last post by:
Why isn't my "catch" catching? TIA, Larry Woods This script get's this output:: Warning: Division by zero in C:\Inetpub\wwwroot\PHP\tests.php on line 4 This will never be printed
6
by: DraguVaso | last post by:
Hi, In my application, on some given actions while debugging in Visual Studio, I suddenly get a "System.ComponentModel.Win32Exception was unhandled" Message="Error creating window handle."...
1
by: Erialc Berts | last post by:
I know why we get this error, but does anyone know how to catch it so that we can display a more helpful message to our users? I am interested both in a .exe and a web site. Thanks in advance...
20
by: DraguVaso | last post by:
Hi, As a former VB-programmer I'm used to the "on error goto"-errorhandling. I see that in actually all the VB.NET-samples I can fin people use the "Try - catch"-errorhandling. Which of the...
7
by: What-A-Tool | last post by:
In the following code, "catch" is underlined in blue, and the error "the variable fx is declared but never used" is displayed when I mouse hover over it. Am I doing something wrong, or do I just...
7
by: dick | last post by:
in the "try{throw}catch" structure, how the C++ code return the "type" thrown by a function?
3
by: G | last post by:
Hello, I have a c# ASPX file, and a Code Behind file. This file has contents POSTED to it, around 15 form fields. Rather than manually catch each Request.Form - is there an easy way to...
6
by: Dave | last post by:
I really don't like the users getting an unhandled expception page, and I'm still to new with ASP.Net and C#. So please accept my appology for the 2 part question. SqlException (0x80131904) ...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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...

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.