473,788 Members | 2,854 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

More Than One Filter On A Form

I have a form with various fields with a double click event to bring
up a filter via a query. Is it possible to goto another field and
apply another filter only to the records that were found after the
first filter.

i.e.

Double Click "Vendor" and "qryfltrDblClic kVendor" runs and returns
records.

Double Click "Mfr" and "qryflterMf r" runs and returns records (I do
not want a complete new filter, I want the previous "Vendor" event to
still apply)

Thanks

Feb 7 '07 #1
4 3016
On 7 Feb 2007 05:11:06 -0800, "bg********@yah oo.com"
<bg********@yah oo.comwrote:

I'm thinking you have qryfltr* that look back at your form for
criteria. E.g.:
select * from sometable where VendorID=Forms! SomeForm!ddlVen dor

If so, then of course you could write qryfltrMfr to be:
select * from sometable where VendorID=Forms! SomeForm!ddlVen dor
and MfrID=Forms!Som eForm!ddlMfr

Btw, the built-in Filter By Form is very good for this kind of
filtering as well.

-Tom.

>I have a form with various fields with a double click event to bring
up a filter via a query. Is it possible to goto another field and
apply another filter only to the records that were found after the
first filter.

i.e.

Double Click "Vendor" and "qryfltrDblClic kVendor" runs and returns
records.

Double Click "Mfr" and "qryflterMf r" runs and returns records (I do
not want a complete new filter, I want the previous "Vendor" event to
still apply)

Thanks
Feb 7 '07 #2
On Feb 7, 7:46 am, Tom van Stiphout <no.spam.tom7.. .@cox.netwrote:
On 7 Feb 2007 05:11:06 -0800, "bgreer5...@yah oo.com"

<bgreer5...@yah oo.comwrote:

I'm thinking you have qryfltr* that look back at your form for
criteria. E.g.:
select * from sometable where VendorID=Forms! SomeForm!ddlVen dor

If so, then of course you could write qryfltrMfr to be:
select * from sometable where VendorID=Forms! SomeForm!ddlVen dor
and MfrID=Forms!Som eForm!ddlMfr

Btw, the built-in Filter By Form is very good for this kind of
filtering as well.

-Tom.
I have a form with various fields with a double click event to bring
up a filter via a query. Is it possible to goto another field and
apply another filter only to the records that were found after the
first filter.
i.e.
Double Click "Vendor" and "qryfltrDblClic kVendor" runs and returns
records.
Double Click "Mfr" and "qryflterMf r" runs and returns records (I do
not want a complete new filter, I want the previous "Vendor" event to
still apply)
Thanks- Hide quoted text -

- Show quoted text -
Tom

Thank you very much. What is ddl for ?

Feb 7 '07 #3
On 7 Feb 2007 06:52:29 -0800, "bg********@yah oo.com"
<bg********@yah oo.comwrote:

dropdown list.
-Tom.

>On Feb 7, 7:46 am, Tom van Stiphout <no.spam.tom7.. .@cox.netwrote:
>On 7 Feb 2007 05:11:06 -0800, "bgreer5...@yah oo.com"

<bgreer5...@ya hoo.comwrote:

I'm thinking you have qryfltr* that look back at your form for
criteria. E.g.:
select * from sometable where VendorID=Forms! SomeForm!ddlVen dor

If so, then of course you could write qryfltrMfr to be:
select * from sometable where VendorID=Forms! SomeForm!ddlVen dor
and MfrID=Forms!Som eForm!ddlMfr

Btw, the built-in Filter By Form is very good for this kind of
filtering as well.

-Tom.
>I have a form with various fields with a double click event to bring
up a filter via a query. Is it possible to goto another field and
apply another filter only to the records that were found after the
first filter.
>i.e.
>Double Click "Vendor" and "qryfltrDblClic kVendor" runs and returns
records.
>Double Click "Mfr" and "qryflterMf r" runs and returns records (I do
not want a complete new filter, I want the previous "Vendor" event to
still apply)
>Thanks- Hide quoted text -

- Show quoted text -

Tom

Thank you very much. What is ddl for ?
Feb 8 '07 #4
Code: AddToFilter -- Add value of current control to form filter
---

on the double-click event of the controls you wish to filter on:

'for text control
=AddTofilter("' ")

'for numeric control
=AddTofilter("" )

'for date control
=AddTofilter("# ")

'~~~~~~~~~
Private Function AddToFilter(pDe li as string)

'if nothing is picked in the active control, exit
If IsNull(Me.Activ eControl) Then Exit Function

'save current record if changes were made
If me.dirty then me.dirty = false

'declare variables

dim mWhere as string
, mRecordID as long

'set value to look up by what is selected
mRecordID = Me.PrimaryKey_f ieldname

mFilter = me.activecontro l.name & "=" _
& pDeli _
& me.activecontro l & pDeli

if len(trim(nz(me. filter,""))) 0 then
me.filter = me.filter & " AND " & mwhere
else
me.filter = mwhere
end if

me.filteron = true
me.requery

'find the record you were on before
Me.RecordsetClo ne.FindFirst _
"PrimaryKey_fie ldname= " & mRecordID

'if a matching record was found, then move to it
If Not Me.RecordsetClo ne.NoMatch Then
Me.Bookmark = Me.RecordsetClo ne.Bookmark
End If

end function

'~~~~~~~~~

where

PrimaryKey_fiel dname is the primary key fieldname (assumeing it is long
integer data type)

pDeli is a delimiter -->
"" for numbers
"'" for text
"#" for dates

another assumption is that the NAME of the each control is the same as
the ControlSource and ytou have not used spaces or special characters in
your fieldnames (except _ is ok)

call
Warm Regards,
Crystal
*
(: have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace200 6 at yahoo.com
*

bg********@yaho o.com wrote:
I have a form with various fields with a double click event to bring
up a filter via a query. Is it possible to goto another field and
apply another filter only to the records that were found after the
first filter.

i.e.

Double Click "Vendor" and "qryfltrDblClic kVendor" runs and returns
records.

Double Click "Mfr" and "qryflterMf r" runs and returns records (I do
not want a complete new filter, I want the previous "Vendor" event to
still apply)

Thanks
Feb 11 '07 #5

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

Similar topics

2
9809
by: Andante.in.Blue | last post by:
Hi everyone! I was wondering if there is a away to use Access 97's build in filter-by-form function but restrict its effect to just the subform. I have a parent form that shows the major divisions of the company, and a subform that is linked so that it displays all the jobs within the division in the parent form. I also want the ability to filter the subform, so the users can pick out a bunch of common jobs easily. I did this using a...
3
6615
by: Richard | last post by:
Hi, I have a form based on a table. When I filter the form I want to run a report based on the same table with the same filter as the form. No problem until I want to filter a combo box where the text value is on a different table. The me.filter is then a text instead of the id-number from the lookup table. This causes the report to prompt for the parameter. How do I get by this problem? Do I need to create a temporary table? I rather...
1
4546
by: jeffgeorge | last post by:
Hi all. Trying to move Filter By Selection, Filter By Form, and Apply/Remove Filter directly into my form. No luck. Is there anyway to move them into the header of the form or, as another option, is the code needed to write out a filter worth pursuing? jg
7
6288
by: damjanu | last post by:
Hi All; I need little help. I have a datasheet form. I allow user to do 'filter by selection'. My form contains a column with values. As user changes selections, I want to calculate totals. I can do this the first time the form loads.
0
2246
by: Malcolm Cook | last post by:
I've discovered: Using "File > Print Preview" in a form's datasheet view with a server Filter crashes access after previewing... ....that is, unless ServerFilterByForm has been turned off after applying the filter. See the steps to recreate bug below for details.
2
4033
by: Lenin Torres | last post by:
Hi everybody I have an Union Query that works fine. I used this query as the RecordSource for a Form. That Form is used as a subform in another form. Everything works fine, except for the "Filter by form" feature. When the user tries to use Filter by form a messagebox is displayed: "There are too many controls in this form to perform a filter by form", after that,when the user exit the Filter by Form mode, Access crash, displaying a...
3
6748
by: Henrootje | last post by:
I have a form based on the query: SELECT tblCreditGeld.CG_Selected, tblCreditGeld.CG_ClientSelected, tblCreditGeld.CG_ComplexSelected, tblCreditGeld.CG_OKGR_ID, tblCreditGeld.CG_OKGR_IDN, tblCreditGeld.CG_client_n, tblCreditGeld.CG_COMP_NR, tblCreditGeld.CG_BANKREK_NR, tblCreditGeld.CG_clientnm, tblCreditGeld.CG_K_MUNT_ISO, tblCreditGeld.CG_GRV, tblCreditGeld.CG_kcons, tblCreditGeld.CG_unit, tblCreditGeld.CG_Kode,...
1
6800
by: woodey2002 | last post by:
Hi Everyone and many thanks for your time.. I am trying to begin access and a bit of VBA i am enjoying it but I have a annoying problem I just can’t get any where on. My databse mostly includes bits of code for different examples. I have one last thing to finish. I am trying to create a search form that will allow users to select criteria from multiple sources eg ,multi select list boxes , combo boxes. I have a subform showing all the...
2
6231
by: ccmanc68 | last post by:
I have on my main form two control text boxes: "ContractNo" and "Buyer", I also have a form control subform: "Contracts". Using the following code, If I enter "25" in the "Buyer" Control, this will filter the "Contracts Subform to show only the entries with buyer 25. Private Sub Buyer_AfterUpdate() Forms!!.Form.Filter = "=" & Me.Buyer Forms!!.Form.FilterOn = True End Sub Also using the following code, if I enter "11" in the...
0
9656
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, 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...
0
9498
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,...
0
10364
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10172
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 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...
1
7517
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 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...
0
5398
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...
0
5536
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4069
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.