Form AfterUpdate

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.
 
A

Alex White MCDBA MCSE

Hi Ray,

You have an error in your code

the line

Resume cmbWorks_AfterUpdate

Should be

Resume Exit_cmbWorks_AfterUpdate
 
N

Nikos Yannacopoulos

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top