(Msg. 1) Posted: Fri Jul 04, 2008 4:24 am
Post subject: error logs Add to elertz Archived from groups: microsoft>public>access (more info?)
I'm starting to set up a routine to log errors. I was looking at Allen
Brown's routine and would like to incorporate it in my program. What I need
to know is how to set it up. I've looked at his program and it's kinda
confusing to me. Bare in mind that I've only been using access for about a
month so what goes where or how its triggered is baffling. I do have the
regular error handing codes within the procedure. I was just wondering if the
function part of his program goes in to a module and how to call the module
on error.
(Msg. 2) Posted: Fri Jul 04, 2008 9:19 am
Post subject: Re: error logs Add to elertz [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
On Fri, 4 Jul 2008 04:24:01 -0700, Afrosheen
<Afrosheen.DeleteThis@discussions.microsoft.com> wrote:
The function LogError goes in a standard module.
The page has an example of how to call it:
Call LogError(Err.Number, Err.Description, "SomeName()")
-Tom.
>I'm starting to set up a routine to log errors. I was looking at Allen
>Brown's routine and would like to incorporate it in my program. What I need
>to know is how to set it up. I've looked at his program and it's kinda
>confusing to me. Bare in mind that I've only been using access for about a
>month so what goes where or how its triggered is baffling. I do have the
>regular error handing codes within the procedure. I was just wondering if the
>function part of his program goes in to a module and how to call the module
>on error.
>
>I hope someone can explain it to me.
>
>Thanks for reading my post.
(Msg. 3) Posted: Sat Jul 05, 2008 12:20 am
Post subject: Re: error logs Add to elertz [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
Yes: the Function ErrorLog() goes into a standard module (one that shows on
the Modules tab of the database window/nav pane.)
--
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.
"Afrosheen" <Afrosheen.TakeThisOut@discussions.microsoft.com> wrote in message
news:89200C94-6E49-4EBE-AB08-C86A23123BDF@microsoft.com...
> I'm starting to set up a routine to log errors. I was looking at Allen
> Brown's routine and would like to incorporate it in my program. What I
> need
> to know is how to set it up. I've looked at his program and it's kinda
> confusing to me. Bare in mind that I've only been using access for about a
> month so what goes where or how its triggered is baffling. I do have the
> regular error handing codes within the procedure. I was just wondering if
> the
> function part of his program goes in to a module and how to call the
> module
> on error.
>
> I hope someone can explain it to me.
>
> Thanks for reading my post.
(Msg. 4) Posted: Sat Jul 05, 2008 12:20 am
Post subject: Re: error logs Add to elertz [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
Your function is called like this:
Call LogError(Err.Number, Err.Description, "SomeName()")
Personally I would not pass in the Err.Number and Description. The Err
object is global so the function can read these values itself.
In the occasional case you want a different description you could code
that as:
Err.Description = Err.Description & " My additional text goes here"
Call LogError(Err.Number, Err.Description, "SomeName()")
-Tom.
>Presumably we are talking about this link:
> http://allenbrowne.com/ser-23a.html >
>Yes: the Function ErrorLog() goes into a standard module (one that shows on
>the Modules tab of the database window/nav pane.)
(Msg. 5) Posted: Sat Jul 05, 2008 12:20 am
Post subject: Re: error logs Add to elertz [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
Thanks for the info. Thanks to Allen also for the routine. I'll try and apply
it. I'll try and follow it. I already have the module and the table set up.
So now it's just incorporating it. I'll try and set up one prodedure and get
that working then redo the other procedures. In fact here is one of the
procedures.
Private Sub Form_Current()
On Error GoTo Form_Current_Error
If trainer = True Then
cmdtoggle.Enabled = True
Else
cmdtoggle.Enabled = False
End If
On Error GoTo 0
Exit Sub
Form_Current_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure
Form_Current of VBA Document Form_frm_emergency"
End Sub
I have other people than me running the program so I wanted something that
would keep track of the errors and tell me if there was a problem.
Thanks again..
"Tom van Stiphout" wrote:
> On Sat, 5 Jul 2008 00:20:02 +0800, "Allen Browne"
> <AllenBrowne.RemoveThis@SeeSig.Invalid> wrote:
>
> Your function is called like this:
> Call LogError(Err.Number, Err.Description, "SomeName()")
> Personally I would not pass in the Err.Number and Description. The Err
> object is global so the function can read these values itself.
> In the occasional case you want a different description you could code
> that as:
> Err.Description = Err.Description & " My additional text goes here"
> Call LogError(Err.Number, Err.Description, "SomeName()")
>
> -Tom.
>
>
> >Presumably we are talking about this link:
> > http://allenbrowne.com/ser-23a.html > >
> >Yes: the Function ErrorLog() goes into a standard module (one that shows on
> >the Modules tab of the database window/nav pane.)
>
(Msg. 6) Posted: Sat Jul 05, 2008 12:20 am
Post subject: Re: error logs Add to elertz [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
Update:
I created an error and this is what I got: Compile Error. Expected variable
or procedure, not module.
Here is the code:
Private Sub Form_Open(Cancel As Integer)
' fld = True
On Error GoTo Form_Open_Error
x = y
domd.help
On Error GoTo 0
Exit Sub
Form_Open_Error:
Call LogError(Err.Number, Err.Description, "form_open()")
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure
Form_Open of VBA Document Form_frm_emergency"
End Sub
"Afrosheen" wrote:
> Thanks for the info. Thanks to Allen also for the routine. I'll try and apply
> it. I'll try and follow it. I already have the module and the table set up.
> So now it's just incorporating it. I'll try and set up one prodedure and get
> that working then redo the other procedures. In fact here is one of the
> procedures.
>
> Private Sub Form_Current()
> On Error GoTo Form_Current_Error
>
> If trainer = True Then
> cmdtoggle.Enabled = True
> Else
> cmdtoggle.Enabled = False
> End If
>
> On Error GoTo 0
> Exit Sub
>
> Form_Current_Error:
>
> MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure
> Form_Current of VBA Document Form_frm_emergency"
> End Sub
>
> I have other people than me running the program so I wanted something that
> would keep track of the errors and tell me if there was a problem.
>
> Thanks again..
>
> "Tom van Stiphout" wrote:
>
> > On Sat, 5 Jul 2008 00:20:02 +0800, "Allen Browne"
> > <AllenBrowne.TakeThisOut@SeeSig.Invalid> wrote:
> >
> > Your function is called like this:
> > Call LogError(Err.Number, Err.Description, "SomeName()")
> > Personally I would not pass in the Err.Number and Description. The Err
> > object is global so the function can read these values itself.
> > In the occasional case you want a different description you could code
> > that as:
> > Err.Description = Err.Description & " My additional text goes here"
> > Call LogError(Err.Number, Err.Description, "SomeName()")
> >
> > -Tom.
> >
> >
> > >Presumably we are talking about this link:
> > > http://allenbrowne.com/ser-23a.html > > >
> > >Yes: the Function ErrorLog() goes into a standard module (one that shows on
> > >the Modules tab of the database window/nav pane.)
> >
(Msg. 7) Posted: Sat Jul 05, 2008 3:00 am
Post subject: Re: error logs Add to elertz [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
Thanks, Tom, for the suggestion.
I would have to think through the implications of what you are saying.
Benefits of *not* passing the error number and description would include the
fact that the Err object is already global, and supports mulitple errors
within it. What concerns me is the possibility that another error could
occur, so that the current error is not the one that originally occurred.
That was the point of copying the Err.Number and Err.Description from the
Err object to the variables before passing it.
Could that happen? I don't know. VBA is not multi-threaded, but JET is. Is
there a chance that it could it fail in some future version of Access? We
are certainly moving towards multi-core machines, and the software will go
that way. VBA is unlikely to be re-written to be multi-threaded, but VBA
calls in JET are not uncommon.
So, I just don't know if it would be 100% reliable or not. It seemed to me
that the safest path was to copy the error info to variable before anything
else happened.
Any further suggestions welcome.
--
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.
"Tom van Stiphout" <no.spam.tom7744 RemoveThis @cox.net> wrote in message
news:c2rs64hdvkj5gqa3mi8sk0m5hpik20c9kn@4ax.com...
> On Sat, 5 Jul 2008 00:20:02 +0800, "Allen Browne"
> <AllenBrowne RemoveThis @SeeSig.Invalid> wrote:
>
> Your function is called like this:
> Call LogError(Err.Number, Err.Description, "SomeName()")
> Personally I would not pass in the Err.Number and Description. The Err
> object is global so the function can read these values itself.
> In the occasional case you want a different description you could code
> that as:
> Err.Description = Err.Description & " My additional text goes here"
> Call LogError(Err.Number, Err.Description, "SomeName()")
>
> -Tom.
>
>
>>Presumably we are talking about this link:
>> http://allenbrowne.com/ser-23a.html
(Msg. 8) Posted: Sat Jul 05, 2008 3:00 am
Post subject: Re: error logs Add to elertz [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
The error message suggests that you have a module with the same name as the
procedure. Try renaming the module to something else, e.g. "Module1".
Then try Compile on the Debug menu (in the code window.)
I'm also unsure of what domd.help does.
--
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.
"Afrosheen" <Afrosheen.TakeThisOut@discussions.microsoft.com> wrote in message
news:873FC56C-E884-4CB2-B7E6-A5C7A135E38F@microsoft.com...
> Update:
> I created an error and this is what I got: Compile Error. Expected
> variable
> or procedure, not module.
>
> Here is the code:
> Private Sub Form_Open(Cancel As Integer)
> ' fld = True
> On Error GoTo Form_Open_Error
>
> x = y
> domd.help
>
> On Error GoTo 0
> Exit Sub
>
> Form_Open_Error:
> Call LogError(Err.Number, Err.Description, "form_open()")
> MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure
> Form_Open of VBA Document Form_frm_emergency"
> End Sub
>
>
> "Afrosheen" wrote:
>
>> Thanks for the info. Thanks to Allen also for the routine. I'll try and
>> apply
>> it. I'll try and follow it. I already have the module and the table set
>> up.
>> So now it's just incorporating it. I'll try and set up one prodedure and
>> get
>> that working then redo the other procedures. In fact here is one of the
>> procedures.
>>
>> Private Sub Form_Current()
>> On Error GoTo Form_Current_Error
>>
>> If trainer = True Then
>> cmdtoggle.Enabled = True
>> Else
>> cmdtoggle.Enabled = False
>> End If
>>
>> On Error GoTo 0
>> Exit Sub
>>
>> Form_Current_Error:
>>
>> MsgBox "Error " & Err.Number & " (" & Err.Description & ") in
>> procedure
>> Form_Current of VBA Document Form_frm_emergency"
>> End Sub
>>
>> I have other people than me running the program so I wanted something
>> that
>> would keep track of the errors and tell me if there was a problem.
>>
>> Thanks again..
>>
>> "Tom van Stiphout" wrote:
>>
>> > On Sat, 5 Jul 2008 00:20:02 +0800, "Allen Browne"
>> > <AllenBrowne.TakeThisOut@SeeSig.Invalid> wrote:
>> >
>> > Your function is called like this:
>> > Call LogError(Err.Number, Err.Description, "SomeName()")
>> > Personally I would not pass in the Err.Number and Description. The Err
>> > object is global so the function can read these values itself.
>> > In the occasional case you want a different description you could code
>> > that as:
>> > Err.Description = Err.Description & " My additional text goes here"
>> > Call LogError(Err.Number, Err.Description, "SomeName()")
>> >
>> > -Tom.
>> >
>> >
>> > >Presumably we are talking about this link:
>> > > http://allenbrowne.com/ser-23a.html >> > >
>> > >Yes: the Function ErrorLog() goes into a standard module (one that
>> > >shows on
>> > >the Modules tab of the database window/nav pane.)
>> >
All times are: Eastern Time (US & Canada) (change) Goto page 1, 2
Page 1 of 2
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum