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

Filter by Form - no records

P: n/a
If I do a filter by form and no records found, how can I identify this result
and automatically perform a command such as put up a message box?

Thank you for the help in advance.
Nov 13 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
make a clone of the recordset and count the records....

if you would like more help on how to do this, let me know.
"MFS 43" <mf***@aol.com> wrote in message
news:20***************************@mb-m01.aol.com...
If I do a filter by form and no records found, how can I identify this result and automatically perform a command such as put up a message box?

Thank you for the help in advance.

---
Please immediately let us know (by phone or return email) if (a) this email
contains a virus
(b) you are not the intended recipient
(c) you consider this email to be spam.
We have done our utmost to make sure that
none of the above are applicable. THANK YOU
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.690 / Virus Database: 451 - Release Date: 22/05/2004
Nov 13 '05 #2

P: n/a
make a clone of the recordset and count the records....

if you would like more help on how to do this, let me know.
"MFS 43" <mf***@aol.com> wrote in message
news:20***************************@mb-m01.aol.com...
If I do a filter by form and no records found, how can I identify this result and automatically perform a command such as put up a message box?

Thank you for the help in advance.

---
Please immediately let us know (by phone or return email) if (a) this email
contains a virus
(b) you are not the intended recipient
(c) you consider this email to be spam.
We have done our utmost to make sure that
none of the above are applicable. THANK YOU
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.690 / Virus Database: 451 - Release Date: 22/05/2004
Nov 13 '05 #3

P: n/a
I have already tried that. I put the following code at the end of the
OnApplyFilter event.

Dim rst As Recordset
Dim db As Database
Set db = CurrentDb

Set rst = Me.RecordsetClone

MsgBox (rst.RecordCount)

This generates the message: " You entered an expression that has an
invalid reference to the RecordsetClone property."
Michael S

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 13 '05 #4

P: n/a
This is what I do:

In Declarations section of the form's Class Module:
Dim FBF As Boolean

In On Filter Event:
If FilterType = 0 Then 'Filter By Form
FBF = True
End If

In Current Event:
If Me.NewRecord Then
If FBF = True Then
MsgBox "No records from the current recordset match the criteria."
DoCmd.RunCommand acCmdRemoveFilterSort
End If
End If
FBF = False

HTH
Nov 13 '05 #5

P: n/a
Thanks for the help but this does not seem to work.

With the Filter By Form and no records found, the form that is shown is
not recognized as a "NewRecord".

Michael S

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 13 '05 #6

P: n/a
Mike 43 <an*******@devdex.com> wrote in message news:<40*********************@news.frii.net>...
Thanks for the help but this does not seem to work.

With the Filter By Form and no records found, the form that is shown is
not recognized as a "NewRecord".

Michael S

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


I have assumed that you are using the standard Access built-in Filter
by Form command, not intercepted using a custom filter form and not a
custom filter procedure. Is this not the case?

Jon
Nov 13 '05 #7

P: n/a
That's correct. I am using the standard FBF, not a custom one.

Thank you again for all your help. If you have other ideas let me know.

However, I have worked around the problem by using the OnTimer event and
counting records in the RecordsetClone.

Michael S

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 13 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.