473,406 Members | 2,713 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.

Use (or) & (and) comand in same time

Hello

i have three field used for filter the subform
i built the code of filter
but i am so weak in VB so i need to put all code of filter together to i can filter by any one at time or used all in same time to filter or two of thim at time

like:
code
(or)
Code
(or)
code

-------

code
(and)
code
(and)
code


i hope my question is clear:)


thanks in advance....
Sep 19 '10 #1

✓ answered by liimra

You can use If Then in a way where the filter will be based on the populated fields.

Expand|Select|Wrap|Line Numbers
  1. If [A] Is Not Null And [b] Is Null And [C] Is Null
  2. 'set the action you want WHERE THE FILTER is [A]
  3. End If
  4. IF [A] Is Not Null And [b] Is Not Null And [C] Is Null
  5. 'set the action you want WHERE THE FILTER is [A] & [b]
  6. End If
  7. IF [A] Is Not Null And [b] Is Not Null And [C] Is Not Null
  8. 'set the action you want WHERE THE FILTER is [A] & [b] & [C]
  9. End If
  10. IF [A] Is Null And [b] Is Not Null And [C] Is Null
  11. 'set the action you want WHERE THE FILTER is [b] & [C]
  12. End If
  13. IF [A] Is Null And [b] Is Not Null And [C] Is Null
  14. 'set the action you want WHERE THE FILTER IS [b]
  15. End If
  16. IF [A] Is Null And [b] Is Null And [C] Is Not Null
  17. 'set the action you want WHERE THE FILTER is [C]
  18. End If
  19.  

Regards,
Ali

6 1361
liimra
119 100+
You can use If Then in a way where the filter will be based on the populated fields.

Expand|Select|Wrap|Line Numbers
  1. If [A] Is Not Null And [b] Is Null And [C] Is Null
  2. 'set the action you want WHERE THE FILTER is [A]
  3. End If
  4. IF [A] Is Not Null And [b] Is Not Null And [C] Is Null
  5. 'set the action you want WHERE THE FILTER is [A] & [b]
  6. End If
  7. IF [A] Is Not Null And [b] Is Not Null And [C] Is Not Null
  8. 'set the action you want WHERE THE FILTER is [A] & [b] & [C]
  9. End If
  10. IF [A] Is Null And [b] Is Not Null And [C] Is Null
  11. 'set the action you want WHERE THE FILTER is [b] & [C]
  12. End If
  13. IF [A] Is Null And [b] Is Not Null And [C] Is Null
  14. 'set the action you want WHERE THE FILTER IS [b]
  15. End If
  16. IF [A] Is Null And [b] Is Null And [C] Is Not Null
  17. 'set the action you want WHERE THE FILTER is [C]
  18. End If
  19.  

Regards,
Ali
Sep 19 '10 #2
thank you Ali for help me

i will not forget your favor with me
Sep 19 '10 #3
liimra
119 100+
We are all here to help. Glad it worked for you mate.

Regards,
Ali
Sep 19 '10 #4
NeoPa
32,556 Expert Mod 16PB
To be fair, this approach can get very cumbersome very quickly. It will work for very simple scenarios but is not a good approach going forward.

Have a look at Cascaded Form Filtering to see how this whole subject can be handled more flexibly and more simply.
Sep 20 '10 #5
liimra
119 100+
I just wanted to offer a simple/easy to understand approach. However, it is indeed not the best approach for filtering. I didn't try NeoPa's approach but think it must be a better one.

It is worth mentioning that one good thing about Access is that even with little knowledge you can make good achievements (working around).

Regards,
Ali
Sep 20 '10 #6
NeoPa
32,556 Expert Mod 16PB
Ali:
It is worth mentioning that one good thing about Access is that even with little knowledge you can make good achievements (working around).
That's very true, and all suggestions are welcome.
Sep 27 '10 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

12
by: Sammy | last post by:
Hi, my mind is going crazy. I have tried everything I can think of to no avail. I have tried Disable Output Escaping. I tried to think of a way of enclosing the attribute data in a CDATA...
21
by: siliconwafer | last post by:
Hi, In case of following expression: c = a && --b; if a is 0,b is not evaluated and c directly becomes 0. Does this mean that && operator is given a higher precedence over '--'operator? as...
6
by: Jason Shohet | last post by:
2 questions for anyone who can answer: 1. in class declarations, I realize you have to use the NEW keyword if you want to declare & instantiate some class at the same time. Whats an advantage...
2
by: Amrit | last post by:
Hi Can anyone help me? I would really appreciate I am trying to scroll Groupboxes inside the panel when i hold panel's scroll bar and drag up and down. Such as Internet explorer where you can hold...
4
by: Jess | last post by:
Hello, There's an access database on an iisserver and asp makes updates to it. The database got moved to a newer server. The users used to be able to open the database and use the asp pages at...
0
by: genzy | last post by:
I'm facing the below problem. With <deny users="?" />, the Windows Login ID is able to be obtained to fill up the Windows IDSID text field automatically, but reading the file info is failed. ...
0
by: wardemon | last post by:
Hi All, Is there any way that I can show a bound field's HeaderText and HeaderImageUrl at the same time in a DetailsView control? As per MSDN, HeaderImageUrl will take precedence if both were...
0
by: magnolia | last post by:
i created a trigger that will record the changes made to a table .everything works fine except the insert query.whenerever i try to insert a record it fires insert and update triger at the same time...
1
by: bsonline | last post by:
I want to use history.back(-1) and refresh the page at same time .. like with history.back(-1) event when the destination page is displayed at that it also be refreshed. is this possible ?
1
by: Jason7899 | last post by:
hi, i looking for do a solution to upload multi images and preview them or remove them at same time without reload page like in the picture that i have annexed in this post. how can i do that?...
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?
1
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...
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
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.