Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

? what event is triggered after ApplyFilter ?

Status
Not open for further replies.

hovercraft

Technical User
Jun 19, 2006
236
US
Which event happens to a form directly following a filter being applied?

For instance a user presses the filter by form button, enters their criteria and then presses the apply filter button. The form changes the record being displayed. Which event happens next?

Hope this question makes sense.

-Hovercraft
 
On Apply Filter is the event you want, I believe.
 
Thanks Remou. I've been trying to use "me.recordsetclone.recordcount" in the ApplyFilter event however I receive an error. I can use me.recordsetclone.recordcount in such things as afterupdate of a field or even on change. But I can't seem to figure out which event is happening when the data on the form is updating from the filter being applied.
If I could find that out then I could assign recordsetclone to it.
Basically I'm just trying to get the number of records returned when a filter is applied. I can't use a separate query at this stage because of the way the whole db is setup. The users have to use a filter (for now).
 
Have you tried (?):

me.recordset.recordcount

What error are you getting?
 
I have not tried recordset.recordcount. I will try that next.
The error I'm getting = Run-Time error 7951
You entered an expression that has an invalid reference to the RecordsetClone property

I only get the error on ApplyFilter.

 
Ok. I had not tested far enough. I get the same problem with filter by form. Is creating your own form for filtering an option?
 
using me.recordset.recordcount on apply filter I get "variable not set" error.

The current design of the db makes changing anything a nightmare. There are no variables used anywhere plus the form and the table have the same name. There are countless reports and queries pointing to either the table or the form so I would basically have to re-write the whole thing (which I am doing).
 
Are you sure you use VBA code in the the event Procedure (ie not macro)

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
The whole thing works fine if a filter is applied, where it falls apart in my version of Access (2000) is when Filter By Form is used:

Code:
Private Sub Form_ApplyFilter(Cancel As Integer, ApplyType As Integer)
If ApplyType = acApplyFilter Then
    MsgBox Me.Recordset.RecordCount
ElseIf ApplyType = acShowAllRecords Then
    MsgBox Me.Recordset.RecordCount
End If
End Sub
 
PHV, Yes we have no bananas. I mean macros.

Remou, That is exactly the problem. We are using the filter by form.
I figure if I could pinpoint the event following the apply filter I should be able to make this work.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top