NewRecord - Using with OnCurrent

  • Thread starter Thread starter JCabralda
  • Start date Start date
J

JCabralda

Guest
I thought this would be simple but somehow it isn't working...

When the user moves to a new record, I just want to check whether the record is a new record or a previously existing one. If it's new, I want to reset the values of some unbound checkboxes so they're all unchecked. I'm using this code in the On Current event of the form:

Private Sub Form_Current()
If Me.NewRecord = True Then
Hospitalization.Value = False
CongenitalMalformation.Value = False
Disability.Value = False
[Life-Threathening].Value = False
Death.Value = False
Other.Value = False
NoActionTaken.Value = False
DoseReduction.Value = False
TreatmentInterrupted.Value = False
DiscontinuedStudy.Value = False
End If
End Sub

However, it resets the checkbox values to False even if the record is previously existing. What am I doing wrong?
 
:mad: Hello JCabralda!
Write
If NewRecord Then
.
.
 
Thanks - but nope, it still sets the checkboxes back to False even if the record was preexisting.
 
Try this:
Private Sub Form_Current()
If Me.NewRecord Then
Me.Hospitalization.Value = False
Me.CongenitalMalformation.Value = False
Me.Disability.Value = False
Me.[Life-Threathening].Value = False
Me.Death.Value = False
Me.Other.Value = False
Me.NoActionTaken.Value = False
Me.DoseReduction.Value = False
Me.TreatmentInterrupted.Value = False
Me.DiscontinuedStudy.Value = False
End If
End Sub
hth.
 
Using me.newrecord OR newrecord must be OK. Perhaps the problem is not "newRecord" function.
Please check.
1. What is the status of check boxes when the record is existing record ? There 2 possibility .
a. do nothing, hold the existing status. It mean your code OK.
b. set to certain status. It it mean you have to write code for ELSE condition.
2. do you have sub form for your records ? If yes, you have to refer to master form control to change the status of the check boxes, if No.... I don't know what is the problem.
 
Daah, I think I see the problem said the blind man. This is in the form's OnCurrent event correct? If so try it in the On Open Event instead. hth.
 

Users who are viewing this thread

Back
Top Bottom