J
John S. Ford, MD
I have a form frmPatientNewEntry with the following property settings:
RecordSource = tblDATA_Patients
DataEntry = Yes (the form is a ONLY used to enter one new patient at a time)
The most important field (except for the primary field PatientIDNum) is
PatientMRNumber. The user must manually enter this first in TextBox
txtPatientMRNumber. txtPatientMRNumber has the following properties set:
ValidationRule = Like "#######"
ValidationText = "MR Number's must have exactly seven consecutive digits
with no letters or punctuation."
The field PatientMRNumber in tblDATA_Patients has the following properties:
Required = Yes
Allow Zero Length = No
Indexed = Yes (No Duplicates)
Among other problems with this form, I have a cmdCancel button with the
following code that should allow the user to exit and not save an aborted
attempt to enter a new patient:
Private Sub cmdCancel_Click()
Me.Undo
Me.Dirty = False
DoCmd.Close
End Sub
When the user clicks this, txtPatientMRNumber gets cleared (presumably the
Me.Undo changes the field entry to NULL or perhaps ""). The problem is that
the ValidationRule keeps getting tested (and fails because the underlying
table has the Required property for this field set to Yes and
AllowZeroLength = No) and DoCmd.Close never executes.
How can I roll the record back to a "virgin" new record thereby bypassing
the validation rule before closing?
Thanks in advance!
John
RecordSource = tblDATA_Patients
DataEntry = Yes (the form is a ONLY used to enter one new patient at a time)
The most important field (except for the primary field PatientIDNum) is
PatientMRNumber. The user must manually enter this first in TextBox
txtPatientMRNumber. txtPatientMRNumber has the following properties set:
ValidationRule = Like "#######"
ValidationText = "MR Number's must have exactly seven consecutive digits
with no letters or punctuation."
The field PatientMRNumber in tblDATA_Patients has the following properties:
Required = Yes
Allow Zero Length = No
Indexed = Yes (No Duplicates)
Among other problems with this form, I have a cmdCancel button with the
following code that should allow the user to exit and not save an aborted
attempt to enter a new patient:
Private Sub cmdCancel_Click()
Me.Undo
Me.Dirty = False
DoCmd.Close
End Sub
When the user clicks this, txtPatientMRNumber gets cleared (presumably the
Me.Undo changes the field entry to NULL or perhaps ""). The problem is that
the ValidationRule keeps getting tested (and fails because the underlying
table has the Required property for this field set to Yes and
AllowZeroLength = No) and DoCmd.Close never executes.
How can I roll the record back to a "virgin" new record thereby bypassing
the validation rule before closing?
Thanks in advance!
John