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

advanced filter

I have made a form (filterform) where I can select 3 conditions, to open
another form (showrecords), filtered with the 3 conditions.

On the filterform: 3 drop down boxes, where the user kan choose: name,
machine, area. And a button "start search".
By clicking the button, showrecords opens with filter: name = x and machine
= y and area = z.

That works good!

But what I don't find is to make it possible for the user to, by example,
only give a value to 1 or 2 of the criteria on filterform and opens
showrecords only with those criteria. When I let a drop box empty, the
filter looks for empty records. When I use a wildcard, it also don't works.

Anybody knows a solution?

Johan


Nov 12 '05 #1
1 5918
Johan,
2 options: (Second option is best)

1: In your query use conditions as Like Forms!FilterFormName!Name & "*"
This works in most cases but gives unwanted results based on the possible values of 'Name'
e.g. Your combo says "John" and in results also "Jonathan" is shown.

2: Construct a whereClause (strWhere) in runtime based on the combos with chosen values
Aircode: Me points to your form, also assuming name, machine and area are textfields (mind the
quotes)

Dim strWhere as string
strWhere = "1=1" 'This is *always* true ;-)
if not isnull(Me!Name) then strWhere =strWhere & " AND Name = '" & Me!Name & "'"
if not isnull(Me!Machine) then strWhere =strWhere & " AND Machine = '" & Me!Machine & "'"
if not isnull(Me!Area) then strWhere =strWhere & " AND Area = '" & Me!Area & "'"
Then open your form with Docmd.Openform "FormName", , , strWhere

--
Hope this helps
Arno R
"Johan" <jo***********@pandora.be> schreef in bericht
news:Sj*******************@phobos.telenet-ops.be...
I have made a form (filterform) where I can select 3 conditions, to open
another form (showrecords), filtered with the 3 conditions.

On the filterform: 3 drop down boxes, where the user kan choose: name,
machine, area. And a button "start search".
By clicking the button, showrecords opens with filter: name = x and machine
= y and area = z.

That works good!

But what I don't find is to make it possible for the user to, by example,
only give a value to 1 or 2 of the criteria on filterform and opens
showrecords only with those criteria. When I let a drop box empty, the
filter looks for empty records. When I use a wildcard, it also don't works.

Anybody knows a solution?

Johan


Nov 12 '05 #2

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

Similar topics

2
by: intl04 | last post by:
Is it possible to create an Access database that searches on multiple fields or can process multiple search keywords (for a photos database) or is it best to just use third-party software such as...
2
by: Mike Sweetman | last post by:
I have a form Form1 which when the Advanced Filter/Sort is used creates a form(maybe) with a title 'Form1Filter1 : Filter'. When I apply the filter to Form1 it is applied, but the value of...
4
by: Nhmiller | last post by:
This is directly from Access' Help: "About designing a query When you open a query in Design view, or open a form, report, or datasheet and show the Advanced Filter/Sort window (Advanced...
2
by: Brad Shook | last post by:
First of all thinks to Cor Ligthert for helping me with this last week. If you wild like to read Cor's comments please refer to the posting from 10/14/2004 and 8:48AM "Help with Advanced...
2
by: A.M | last post by:
Hi, Is there any online resource that gives examples about advanced python string, list and map operations? Today I saw this and I found that I have to work more on mentioned topics:
18
by: dlesandrini | last post by:
Has anyone noticed that the Google Groups Advanced Search no longer works correctly? Is it something I'm doing or have others noticed the change? Used to be, if I put *access* in the Groups...
0
by: Andrew Meador - ASCPA, MCSE, MCP+I, Network+, A+ | last post by:
I am running Access 2007. I have a report that I want to filter. I can go into Advanced...Advanced Filter/Sort... and setup a filter that works fine on the report when I apply it. When in this...
0
by: Andrew Meador - ASCPA, MCSE, MCP+I, Network+, A+ | last post by:
I am running Access 2007. I have a report that I want to filter. I can go into Advanced...Advanced Filter/Sort... and setup a filter that works fine on the report when I apply it. When in this...
4
by: DAnDA | last post by:
I have a Gridview Which as you know it was sorted by Ascending by default. Now i want Gridview to Sorting Descending On Load,,, i want somthing like Below: protected void Page_Load(object...
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...
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
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
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
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
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.