PC Review


Reply
Thread Tools Rate Thread

How to find out what events are firing?

 
 
Dorian
Guest
Posts: n/a
 
      2nd Dec 2008
I just started getting a 'no current record' error on an ApplyFilter
statement (it worked fine before). However, the actual error is elsewhere -
in some event being fired. I know the Current event is firing but I think the
error is somewhere else. How can I find out where? I tried setting a
breakpoint and stepping through but it always stops on the ApplyFilter
statement and says "you can't use this statement in this window".

Thanks for any assistance. This has had me stuck for quite a while.
 
Reply With Quote
 
 
 
 
Allen Browne
Guest
Posts: n/a
 
      2nd Dec 2008
Access doesn't provide information on what event triggered a message. It may
be the form's Error event.

If it happens only when you use the ApplyFilter action (in a macro) or
method (in VBA code), then you already know what event is firing (e.g. the
click of a command button?) Some things to try:

1. If the form has unsaved edits, Access must commit (or undo) these before
the filter can be applied. Try doing that explicitly before applying the
filter.
If Me.Dirty Then Me.Dirty = False
Note that this will fail if the record cannot be saved (e.g. required field
missing.)

2. Try setting the Filter property of the form instead of ApplyFilter, e.g.:
Me.Filter = "(SomeField = 99)"
Me.FilterOn = True

(There is also a bug in Access 2002 Service Pack 3 that causes this message
to be triggered wrongly after you have deleted a record.)

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Dorian" <(E-Mail Removed)> wrote in message
news:0DC50F84-E658-41EC-88B8-(E-Mail Removed)...
>I just started getting a 'no current record' error on an ApplyFilter
> statement (it worked fine before). However, the actual error is
> elsewhere -
> in some event being fired. I know the Current event is firing but I think
> the
> error is somewhere else. How can I find out where? I tried setting a
> breakpoint and stepping through but it always stops on the ApplyFilter
> statement and says "you can't use this statement in this window".
>
> Thanks for any assistance. This has had me stuck for quite a while.


 
Reply With Quote
 
 
 
 
Dorian
Guest
Posts: n/a
 
      3rd Dec 2008
Thanks for reply.
It turned out that the cause was a corrupted record in the table being
filtered. All columns said #Error. I dont know what caused this corrupted
record but I deleted it and did a compact/repair and now everything works
fine.

-Dorian

"Allen Browne" wrote:

> Access doesn't provide information on what event triggered a message. It may
> be the form's Error event.
>
> If it happens only when you use the ApplyFilter action (in a macro) or
> method (in VBA code), then you already know what event is firing (e.g. the
> click of a command button?) Some things to try:
>
> 1. If the form has unsaved edits, Access must commit (or undo) these before
> the filter can be applied. Try doing that explicitly before applying the
> filter.
> If Me.Dirty Then Me.Dirty = False
> Note that this will fail if the record cannot be saved (e.g. required field
> missing.)
>
> 2. Try setting the Filter property of the form instead of ApplyFilter, e.g.:
> Me.Filter = "(SomeField = 99)"
> Me.FilterOn = True
>
> (There is also a bug in Access 2002 Service Pack 3 that causes this message
> to be triggered wrongly after you have deleted a record.)
>
> --
> Allen Browne - Microsoft MVP. Perth, Western Australia
> Tips for Access users - http://allenbrowne.com/tips.html
> Reply to group, rather than allenbrowne at mvps dot org.
>
> "Dorian" <(E-Mail Removed)> wrote in message
> news:0DC50F84-E658-41EC-88B8-(E-Mail Removed)...
> >I just started getting a 'no current record' error on an ApplyFilter
> > statement (it worked fine before). However, the actual error is
> > elsewhere -
> > in some event being fired. I know the Current event is firing but I think
> > the
> > error is somewhere else. How can I find out where? I tried setting a
> > breakpoint and stepping through but it always stops on the ApplyFilter
> > statement and says "you can't use this statement in this window".
> >
> > Thanks for any assistance. This has had me stuck for quite a while.

>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
events that fire events that fire events....a bad thing? Daniel Microsoft C# .NET 3 1st Feb 2007 02:55 AM
FileSystemWatcher : Need to find out who's firing the events (username,id ?) zcamster@gmail.com Microsoft Dot NET Framework 0 11th Jan 2005 02:29 PM
Events, dear boy, events Gromit Microsoft Excel Misc 0 10th Nov 2004 11:30 PM
Events, dear boy, events Gromit Microsoft Excel Misc 1 10th Nov 2004 11:08 PM
How to find out which events will fire MS News \(MS ILM\) Microsoft ASP .NET 3 30th Mar 2004 08:36 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:50 AM.