troubleshooting Question

Access VBA Compile Error Sub or Function not defined

Avatar of Murray Brown
Murray BrownFlag for United Kingdom of Great Britain and Northern Ireland asked on
Microsoft AccessVBA
3 Comments1 Solution254 ViewsLast Modified:

In my Access VBA code below, the Sub Form_BeforeUpdate code causes an error "Compile Error Sub or Function not defined"

Private blnSaved As Boolean

Private Sub Form_BeforeUpdate(Cancel As Integer)
    If blnSaved = False Then
        Cancel = True
        Cancel = False
    End If
End Sub

Private Sub Form_Current()
    blnSaved = False
End Sub

Private Sub btnOK_Click()
    blnSaved = True
    MsgBox "Changes saved!"
End Sub

Private Sub btnCancel_Click()
End Sub

Open in new window

Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros