Filter by form - apply filter button required - Access 97 
Author Message
 Filter by form - apply filter button required - Access 97

wish to allow my users to filter by form but cannot seem to get the right
code or macro. I have tried Apply filter but have had no luck - maybe I
don't know which arguments to use also when I place the button in the form
header it becomes not enabled.
The idea is to allow the users to choose criteria eventually for a report.
I can achieve the desired result by clicking the apply filter tool on the
toolbar but wish to have a form button instead.
What code/macro should I use?
Brian


Sat, 29 Sep 2001 03:00:00 GMT  
 Filter by form - apply filter button required - Access 97
Make an combo box ("MyFilterField_Pick_List"), which has a picklist with what
should be selected. Make and "afterUpdate" as follows:
************************* Code *********************
'
Private Sub SelectData_AfterUpdate()

    ' Go to the control you want to filter by.
    DoCmd.GoToControl "MyFilterField"
    ' Find the record with the same Site number as in the Site number Pick
List control.
    DoCmd.FindRecord [MyFilterField_Pick_List], acEntire, False, acDown,
False, , True

End Sub

Kind regards

Michael
Please remove no.spam from my e-mail adress if you want to use it.

Quote:

> wish to allow my users to filter by form but cannot seem to get the right
> code or macro. I have tried Apply filter but have had no luck - maybe I
> don't know which arguments to use also when I place the button in the form
> header it becomes not enabled.
> The idea is to allow the users to choose criteria eventually for a report.
> I can achieve the desired result by clicking the apply filter tool on the
> toolbar but wish to have a form button instead.
> What code/macro should I use?
> Brian

       The contents of this message express only the sender's opinion.
       This message does not necessarily reflect the policy or views of
       my employer, Merck & Co., Inc.  All responsibility for the statements
       made in this Usenet posting resides solely and completely with the
       sender.


Sat, 29 Sep 2001 03:00:00 GMT  
 Filter by form - apply filter button required - Access 97
Thanks but it's not to merely select an item it's to filter to get a group
of
records maybe to filter by more than one field as in using the filter by
form
facility.
Same effect as completing data in textboxes or combo boxes then clicking the
apply filter toolbar button.
Any ideas?
Best wishes
Brian


Quote:
>Make an combo box ("MyFilterField_Pick_List"), which has a picklist with
what
>should be selected. Make and "afterUpdate" as follows:
>************************* Code *********************
>'
>Private Sub SelectData_AfterUpdate()

>    ' Go to the control you want to filter by.
>    DoCmd.GoToControl "MyFilterField"
>    ' Find the record with the same Site number as in the Site number Pick
>List control.
>    DoCmd.FindRecord [MyFilterField_Pick_List], acEntire, False, acDown,
>False, , True

>End Sub

>Kind regards

>Michael
>Please remove no.spam from my e-mail adress if you want to use it.

>> wish to allow my users to filter by form but cannot seem to get the right
>> code or macro. I have tried Apply filter but have had no luck - maybe I
>> don't know which arguments to use also when I place the button in the
form
>> header it becomes not enabled.
>> The idea is to allow the users to choose criteria eventually for a
report.
>> I can achieve the desired result by clicking the apply filter tool on the
>> toolbar but wish to have a form button instead.
>> What code/macro should I use?
>> Brian

>       The contents of this message express only the sender's opinion.
>       This message does not necessarily reflect the policy or views of
>       my employer, Merck & Co., Inc.  All responsibility for the
statements
>       made in this Usenet posting resides solely and completely with the
>       sender.



Sat, 29 Sep 2001 03:00:00 GMT  
 Filter by form - apply filter button required - Access 97
RunCommand acCmdFilterByForm

--
Regards
-Stuart McCall

"Time flies like an arrow,
 Fruit flies like a banana"


Quote:
>wish to allow my users to filter by form but cannot seem to get the right
>code or macro. I have tried Apply filter but have had no luck - maybe I
>don't know which arguments to use also when I place the button in the form
>header it becomes not enabled.
>The idea is to allow the users to choose criteria eventually for a report.
>I can achieve the desired result by clicking the apply filter tool on the
>toolbar but wish to have a form button instead.
>What code/macro should I use?
>Brian



Sat, 29 Sep 2001 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Applying a filter on a form filters subforms, too

2. How do you apply filters which require input???

3. Form goes to 1st record when filter applied to subform

4. Access 97 problem on using OpenReport with Filter query

5. filtering records, using dbgrid linked to an access 97 table

6. Applying Filter

7. Applying filters within VB

8. DropDown List Change when Filter is applied

9. Apply filter

10. applying filter on a subform

11. Subform code for apply filter??

12. Apply filter Dynamically to a Report ?

 

 
Powered by phpBB® Forum Software