472,958 Members | 2,162 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,958 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 5856
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: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
2
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.