K
Keith
Greetings:
When users create a new change order (CO) in my app, I've got a little
code that automatically determines the next change order number and
writes it to the first field on the form. If they change their mind
about creating a new record, and press Escape to bail out of the new
record, I want to skip my validation routine. Pressing Escape does, in
fact, clear the values out of the form controls, and remove the
editing symbol from the record selector, but Access still thinks the
record is dirty. Here's the code:
Private Sub Form_BeforeUpdate(Cancel As Integer)
If Me.Dirty Then
'Make sure the project is set to the current project
If IsNull(strProjName) Then strProjName = GetCurrentProject()
If Not FormComplete(Forms!frmCOs) Then
FormReady = False
Cancel = True
Else
FormReady = True
End If
End If
End Sub
FormComplete is a function that reviews the form for the required
data. When I Escape out of the record and close the form, this
function still executes, telling me that I'm missing required fields.
What am I missing? TIA
Keith
When users create a new change order (CO) in my app, I've got a little
code that automatically determines the next change order number and
writes it to the first field on the form. If they change their mind
about creating a new record, and press Escape to bail out of the new
record, I want to skip my validation routine. Pressing Escape does, in
fact, clear the values out of the form controls, and remove the
editing symbol from the record selector, but Access still thinks the
record is dirty. Here's the code:
Private Sub Form_BeforeUpdate(Cancel As Integer)
If Me.Dirty Then
'Make sure the project is set to the current project
If IsNull(strProjName) Then strProjName = GetCurrentProject()
If Not FormComplete(Forms!frmCOs) Then
FormReady = False
Cancel = True
Else
FormReady = True
End If
End If
End Sub
FormComplete is a function that reviews the form for the required
data. When I Escape out of the record and close the form, this
function still executes, telling me that I'm missing required fields.
What am I missing? TIA
Keith