Form AfterUpdate

  • Thread starter Thread starter Ray Hogan
  • Start date Start date
R

Ray Hogan

Hi,
The following code is giving me a "Compile Error: Label not defined".
Private Sub cmbWorks_AfterUpdate()
On Error GoTo Err_cmbWorks_AfterUpdate

Dim stDocName As String

stDocName = "qryAreaNoUpdate"
DoCmd.OpenQuery stDocName, acNormal, acEdit

Exit_cmbWorks_AfterUpdate:
Exit Sub

Err_cmbWorks_AfterUpdate:
MsgBox Err.Description
Resume cmbWorks_AfterUpdate

End Sub

Thanking you in anticipation.
RayH.
 
Hi Ray,

You have an error in your code

the line

Resume cmbWorks_AfterUpdate

Should be

Resume Exit_cmbWorks_AfterUpdate
 
Ray said:
Hi,
The following code is giving me a "Compile Error: Label not defined".
Private Sub cmbWorks_AfterUpdate()
On Error GoTo Err_cmbWorks_AfterUpdate

Dim stDocName As String

stDocName = "qryAreaNoUpdate"
DoCmd.OpenQuery stDocName, acNormal, acEdit

Exit_cmbWorks_AfterUpdate:
Exit Sub

Err_cmbWorks_AfterUpdate:
MsgBox Err.Description
Resume cmbWorks_AfterUpdate
This is where the problem is; the label is *Exit_cmbWorks_AfterUpdate*,
so this line of code muct be changed to:

Resume Exit_cmbWorks_AfterUpdate

to correctly branch to the label.
 
Back
Top