Group:  Microsoft Access ยป microsoft.public.access.formscoding
Thread: How to find out what events are firing?

Geek News

How to find out what events are firing?
Dorian 12/1/2008 11:46:01 PM
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.
Re: How to find out what events are firing?
"Allen Browne" <AllenBrowne[ at ]SeeSig.Invalid> 12/2/2008 1:40:32 AM
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" <Dorian[ at ]discussions.microsoft.com> wrote in message
news:0DC50F84-E658-41EC-88B8-55586F4467BA[ at ]microsoft.com...
[Quoted Text]
>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.

Re: How to find out what events are firing?
Dorian 12/3/2008 7:50:39 PM
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:

[Quoted Text]
> 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" <Dorian[ at ]discussions.microsoft.com> wrote in message
> news:0DC50F84-E658-41EC-88B8-55586F4467BA[ at ]microsoft.com...
> >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.
>
>

Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net