Compile error: label not defined (1 Viewer)

Falcon88

Registered User.
Local time
Today, 18:37
Joined
Nov 4, 2014
Messages
299
Hiii All Dears

I have read http://allenbrowne.com/ser-23a.html
and try to do this in my db .
this works good in forms and reports events.but i try to do in some special functions, but gives me "Compile error: label not defined " massage.

please see my code:

Code:
Public Function OldDts(SerAddDt As Date, MyZXNm As String)

On Error GoTo Err_OldDts         ' Initialize error handling.

My Function

Exit_Function:                          ' Label to resume after error.
   Exit Function                 ' Exit before error handler.
Err_Function:                           ' Label to jump to on error.
Select Case Err.Number
      Case 9999                        ' Whatever number you anticipate.
          Resume Next                  ' Use this to just ignore the line.
      Case 999
          Resume Exit_Function        ' Use this to give up on the proc.
      Case Else                        ' Any unexpected error.
          Call LogError(Err.Number, Err.Description, "OldDts Function")
          Resume Exit_Function
      End Select

End Function
it stop on : On Error GoTo Err_OldDts

Please Help.
 

isladogs

MVP / VIP
Local time
Today, 16:37
Joined
Jan 14, 2017
Messages
18,242
You don't have label called Err_OldDts

In your code it is called Err_Function so alter the second line of your function
 

Gasman

Enthusiastic Amateur
Local time
Today, 16:37
Joined
Sep 21, 2011
Messages
14,332
You need either

Code:
On Error GoTo Err_Function
or
Code:
Exit_Function:                          ' Label to resume after error.
   Exit Function                 ' Exit before error handler.
Err_OldDts:

You are trying to go to a label that you have not defined.

Change one or the other.

Hiii All Dears

I have read http://allenbrowne.com/ser-23a.html
and try to do this in my db .
this works good in forms and reports events.but i try to do in some special functions, but gives me "Compile error: label not defined " massage.

please see my code:

Code:
Public Function OldDts(SerAddDt As Date, MyZXNm As String)

On Error GoTo Err_OldDts         ' Initialize error handling.

My Function

Exit_Function:                          ' Label to resume after error.
   Exit Function                 ' Exit before error handler.
Err_Function:                           ' Label to jump to on error.
Select Case Err.Number
      Case 9999                        ' Whatever number you anticipate.
          Resume Next                  ' Use this to just ignore the line.
      Case 999
          Resume Exit_Function        ' Use this to give up on the proc.
      Case Else                        ' Any unexpected error.
          Call LogError(Err.Number, Err.Description, "OldDts Function")
          Resume Exit_Function
      End Select

End Function
it stop on : On Error GoTo Err_OldDts

Please Help.
 

Falcon88

Registered User.
Local time
Today, 18:37
Joined
Nov 4, 2014
Messages
299
Very Very Thanks

I try the Second choice , it works good.
Code:
Exit_Function:                          ' Label to resume after error.
   Exit Function                 ' Exit before error handler.
Err_OldDts:                           ' Label to jump to on error.
 

Users who are viewing this thread

Top Bottom