From: Tony Toews [MVP] on
Folks

I came across the following line of code which errors out.

If lrc <> ERROR_NONE Then Error 5

You can see examples of this code in MS KB articles. For example
http://support.microsoft.com/kb/210860

This compiles but at execution time causes an error. Now this isn't a
big deal as the code is going to drop out of the routine anyhow.

But I'm curious. What is the Error 5 supposed to be doing?

Tony
--
Tony Toews, Microsoft Access MVP
Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
For a convenient utility to keep your users FEs and other files
updated see http://www.autofeupdater.com/
Granite Fleet Manager http://www.granitefleet.com/
From: Nobody on
"Tony Toews [MVP]" <ttoews(a)telusplanet.net> wrote in message
news:rnfbv59609li420afseegar284ive2i15l(a)4ax.com...
> Folks
>
> I came across the following line of code which errors out.
>
> If lrc <> ERROR_NONE Then Error 5
>
> You can see examples of this code in MS KB articles. For example
> http://support.microsoft.com/kb/210860
>
> This compiles but at execution time causes an error. Now this isn't a
> big deal as the code is going to drop out of the routine anyhow.
>
> But I'm curious. What is the Error 5 supposed to be doing?

It simulates an error, as if it happened. See "Error statement" in MSDN, and
also Err.Raise, which does the same thing. Confused yet? Try this fun code:

Option Explicit

Private Sub Form_Load()
Dim i As Long

On Error Resume Next
For i = 1 To 20
Err.Raise i
Debug.Print "Error " & Err.Number & ": " & Err.Description
Err.Clear
Next

End Sub


From: Larry Serflaten on

"Tony Toews [MVP]" <ttoews(a)telusplanet.net> wrote

> I came across the following line of code which errors out.
>
> If lrc <> ERROR_NONE Then Error 5
<...>
> But I'm curious. What is the Error 5 supposed to be doing?


Its supposed to cause an error.


LFS


From: Karl E. Peterson on
Tony Toews [MVP] wrote:
> Folks
>
> I came across the following line of code which errors out.
>
> If lrc <> ERROR_NONE Then Error 5
>
> You can see examples of this code in MS KB articles. For example
> http://support.microsoft.com/kb/210860
>
> This compiles but at execution time causes an error. Now this isn't a
> big deal as the code is going to drop out of the routine anyhow.
>
> But I'm curious. What is the Error 5 supposed to be doing?

Signals the calling routine it passed an invalid argument. :-)

--
..NET: It's About Trust! http://vfred.mvps.org
Customer Hatred Knows No Bounds at MSFT
ClassicVB Users Regroup! comp.lang.basic.visual.misc
Free usenet access at http://www.eternal-september.org


From: Karl E. Peterson on
Larry Serflaten wrote:
> LFS

Your clock is hosed. Shouldn't you be -0500?

--
..NET: It's About Trust! http://vfred.mvps.org
Customer Hatred Knows No Bounds at MSFT
ClassicVB Users Regroup! comp.lang.basic.visual.misc
Free usenet access at http://www.eternal-september.org