Hi,
Is it possible to filter ontop of the current filter being applied to
records? This seems like it should be easy?
I have two drop down boxes-- one to filter on a student's last name,
one to filter on the current school year. They work seperatly, but not
together. I would like a user, if they want, to be able to apply both
filters at once -- (only a certain school year and only a certain
student). Help?
Current code:
First Drop Down box (filter on Last Name):
Private Sub Text67_Change()
If Me.Dirty Then 'Save first
Me.Dirty = False
End If
If IsNull(Me.Text6 7) Then 'Show all
Me.FilterOn = False
Else
Me.Filter = "[SLastName] Like """ & Me.Text67 & "*"""
Me.FilterOn = True
End If
End Sub
Second Drop Down Box (filter on school year):
Private Sub cmbFSchoolYear_ Change()
If Me.Dirty Then 'Save first
Me.Dirty = False
End If
If IsNull(Me.cmbFS choolYear) Then 'Show all
Me.FilterOn = False
Else
Me.Filter = "[SchoolYear] Like """ & Me.cmbFSchoolYe ar & "*"""
Me.FilterOn = True
End If
End Sub 4 1643
Crispy,
Yes, its doable. You just need to combine the two filter clauses with
an "And". Do this in a separate subroutine in your form module:
Private Sub FilterMe()
Dim sFilter as String
sFilter = ""
If Me.Dirty Then 'Save first
Me.Dirty = False
End If
If Not IsNull(Me.Text6 7) Then
sFilter = "[SLastName] Like """ & Me.Text67 & "*"""
End If
If Not IsNull(Me.cmbFS choolYear) Then
If Len(sFilter) > 0 Then
sFilter = sFilter & " And "
End If
sFilter = sFilter & "[SchoolYear] Like """ & Me.cmbFSchoolYe ar &
"*"""
End IF
If Len(sFilter) > 0 Then
Me.Filter = sFilter
Me.FilterOn = True
Else
Me.FilterOn = False
End IF
End Sub
This builds your filter string, adding an "And" if both filter
conditions are used. If neither filter control is set, it turns the
filter off.
-Ken
Ken,
Thank you for your help. I really appreciate it. That worked perfectly.
Thanks again!
Ken,
One last question. This works if they first filter on Last Name and
then choose from the school year menu...
Is it possible to also make it work if they decide to first filter on
School year and then last name?
So that both scenerios work?
Nevermind. I take that back.
Thanks! This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Dario de Judicibus |
last post by:
I wish to implement a simple C++ filter that reads from a file byte by byte
and writes to an output files two bytes for each byte read according to some
hardcoded table. I am looking for a very straightforward sample. It is
pratically a binary filter.
Thank you in advance.
DdJ
|
by: Salad |
last post by:
I have a log file with a list of records. The log file can be
unfiltered or filtered.
I have a command button to call a data entry form from the log. At
first I was only going to present the record the user selected. Then I
thought, what the heck, give the user all of them but start out at the
record the user is currently on.
If I pass the current filter that resides on the log this causes
problems. For example, if the filter is...
|
by: Afton |
last post by:
I would like to make a form that filters a report by Supervisor and by
starting and ending date.
I have the supervisors in a combo box, and that works.
However, I do not know how to code to let the user enter a starting
and ending date and only show the records between those dates.
The code that I have so far does not work for the dates, but I'm
including it anyway so you show me what to change.
Thanks so much! :)
Here is my code (the...
|
by: cefrancke |
last post by:
I have a form (no underlying record set) that has two separate
sub-forms on it.
Each sub-form has data from two different tables.
Above each sub-form there is one unbound combo box with a SQL record
source that returns an ID field and a Text field.
Next to each combo box is two buttons, one that 'Applys' the filter of
the sub-form to the value in the combo box and one that 'Clears' the
form's current filter.
When the click event of the...
|
by: ViRi |
last post by:
I am writing my own little video player, using
AxMicrosoft.MediaPlayer.Interop.AxWindowsMediaPlayer, and i want to add
stats when in fullscreen.
I am able to Draw to it with GDI+, but since there's a high framerate,
it flickers...
HWND = FindWindow("WindowsForms10.Window.8.app.0.378734a",
null);
| |
by: mpdoreilly |
last post by:
Hi,
I've a webservice that has several typical webmethods that clients
call and get responses from.
(Side note: The websriivce is actually to implement the server side of
tr-069, the protocol is somewhat funny in that the server can send
arbitrary requests to the client in the RESPONSES to calls to its
webmethods)
|
by: perryche |
last post by:
Is there a way to have a message popup ontop of all windows (not only
in Access, but ontop of other windows) to give users a warning
message?
Does windows XP itself have anykind of instant messaging?
Perry
|
by: franc sutherland |
last post by:
Hello,
I have a report which I filter using the me.filter command in the
OnOpen event.
Me.Filter = "OrderID=" & Forms!variable_form_name!
Me.FilterOn = True
I want to be able to open that report, filtered, from different
forms. How do I carry the name of the current form into the
|
by: newcooler |
last post by:
I have a junction table for instance 1 service can have many contacts - using a composite key junction table.
what i want to do is to filter all the contacts that belong to the service using the junction table that includes just PK to service and PK to contact as a composite key.
I used this code
'set up the agency binding source
With serviceBindingSource
.DataSource = aDataSet
...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |