sportsguy
Finance wiz, Access hack
- Local time
- Yesterday, 23:14
- Joined
- Dec 28, 2004
- Messages
- 358
I have a data entry form based on a query on a table with primary keys. I am using before update to validate that there is data in the fields before saving. When the fields are null, the error message comes up, but then the form tries to save the record and I get error 2015 -
Thanks in advance
sportsguy
Error message from debug is
What am I missing?
Code:
Private Sub Form_BeforeUpdate(Cancel As Integer)
On Error GoTo Err_BeforeUpdate
If IsNull(Me.Medical_Record) Then
MsgBox "Please enter a Medical Record Nbr prior to Saving!", vbCritical, "DATA QUALITY"
Me.Medical_Record.SetFocus
Cancel = True
ElseIf IsNull(Me.Date_RestraintStart) Then
MsgBox "Please enter the Restraint Start Date prior to Saving!", vbCritical, "DATA QUALITY"
Me.Date_RestraintStart.SetFocus
Cancel = True
ElseIf IsNull(Me.StartTime) Then
MsgBox "Please enter the Restraint Start Time prior to Saving!", vbCritical, "DATA QUALITY"
Me.StartTime.SetFocus
Cancel = True
ElseIf IsNull(Me.Type_of_Restraint) Then
MsgBox "Please enter a Type of Restraint prior to Saving!", vbCritical, "DATA QUALITY"
Me.Type_of_Restraint.SetFocus
Cancel = True
End If
Exit_BeforeUpdate:
Exit Sub
Err_BeforeUpdate:
Debug.Print Err.Number & " - " & Err.Description
Goto Exit_BeforeUpdate
End Sub
Thanks in advance
sportsguy
Error message from debug is
2105 - You can't go to the specified record.
What am I missing?