Avatar of Murray Brown
Murray Brown
Flag for United Kingdom of Great Britain and Northern Ireland

asked on 

Access VBA Compile Error Sub or Function not defined

Hi

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
        Me.Undo
        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()
    DoCmd.Close
End Sub

Open in new window

Microsoft AccessVBA

Avatar of undefined
Last Comment
Murray Brown

8/22/2022 - Mon