By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,509 Members | 1,686 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,509 IT Pros & Developers. It's quick & easy.

More Than One Filter On A Form

P: n/a
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 "qryfltrDblClickVendor" runs and returns
records.

Double Click "Mfr" and "qryflterMfr" 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
Share this Question
Share on Google+
4 Replies


P: n/a
On 7 Feb 2007 05:11:06 -0800, "bg********@yahoo.com"
<bg********@yahoo.comwrote:

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

If so, then of course you could write qryfltrMfr to be:
select * from sometable where VendorID=Forms!SomeForm!ddlVendor
and MfrID=Forms!SomeForm!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 "qryfltrDblClickVendor" runs and returns
records.

Double Click "Mfr" and "qryflterMfr" 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

P: n/a
On Feb 7, 7:46 am, Tom van Stiphout <no.spam.tom7...@cox.netwrote:
On 7 Feb 2007 05:11:06 -0800, "bgreer5...@yahoo.com"

<bgreer5...@yahoo.comwrote:

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

If so, then of course you could write qryfltrMfr to be:
select * from sometable where VendorID=Forms!SomeForm!ddlVendor
and MfrID=Forms!SomeForm!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 "qryfltrDblClickVendor" runs and returns
records.
Double Click "Mfr" and "qryflterMfr" 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

P: n/a
On 7 Feb 2007 06:52:29 -0800, "bg********@yahoo.com"
<bg********@yahoo.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...@yahoo.com"

<bgreer5...@yahoo.comwrote:

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

If so, then of course you could write qryfltrMfr to be:
select * from sometable where VendorID=Forms!SomeForm!ddlVendor
and MfrID=Forms!SomeForm!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 "qryfltrDblClickVendor" runs and returns
records.
>Double Click "Mfr" and "qryflterMfr" 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

P: n/a
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(pDeli as string)

'if nothing is picked in the active control, exit
If IsNull(Me.ActiveControl) 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_fieldname

mFilter = me.activecontrol.name & "=" _
& pDeli _
& me.activecontrol & 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.RecordsetClone.FindFirst _
"PrimaryKey_fieldname= " & mRecordID

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

end function

'~~~~~~~~~

where

PrimaryKey_fieldname 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
strive4peace2006 at yahoo.com
*

bg********@yahoo.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 "qryfltrDblClickVendor" runs and returns
records.

Double Click "Mfr" and "qryflterMfr" 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 discussion thread is closed

Replies have been disabled for this discussion.