T
Ted
i created an add record button atop my a2k data entry form which uses the
following vba code:
Private Sub AddRecord_Click()
On Error GoTo Err_AddRecord_Click
Forms("Screening Log").AllowAdditions = True
If Not Me.NewRecord Then DoCmd.GoToRecord , , acNewRec
Me.StudyNumber.Value = "ENTRY REQUIRED"
Me.RegNumber.Value = "ENTRY REQUIRED"
Me.[On-Study Date].Value = #1/1/1900#
DoCmd.GoToControl "StudyNumber"
Forms("Screening Log").Dirty = False
Forms("Screening Log").AllowAdditions = False
Exit_AddRecord_Click:
Exit Sub
Err_AddRecord_Click:
MsgBox Err.description
Resume Exit_AddRecord_Click
End Sub
i don't want the user to be able to move away from this record until the
user has taken care of entering the data in the controls reg#, study# and
on-study date. i know this takes a msgbox and i know we have to trap for the
failure on the user's part, the trick is identifying how to tell vba that's
what the user's trying to do. i tried using the ".oldvalue" feature and
testing for the starting and ending values but that didn't seemt to fit. i
found a blurb about the '.newrecord' property value in the Help
documentation....is this the way to go?
following vba code:
Private Sub AddRecord_Click()
On Error GoTo Err_AddRecord_Click
Forms("Screening Log").AllowAdditions = True
If Not Me.NewRecord Then DoCmd.GoToRecord , , acNewRec
Me.StudyNumber.Value = "ENTRY REQUIRED"
Me.RegNumber.Value = "ENTRY REQUIRED"
Me.[On-Study Date].Value = #1/1/1900#
DoCmd.GoToControl "StudyNumber"
Forms("Screening Log").Dirty = False
Forms("Screening Log").AllowAdditions = False
Exit_AddRecord_Click:
Exit Sub
Err_AddRecord_Click:
MsgBox Err.description
Resume Exit_AddRecord_Click
End Sub
i don't want the user to be able to move away from this record until the
user has taken care of entering the data in the controls reg#, study# and
on-study date. i know this takes a msgbox and i know we have to trap for the
failure on the user's part, the trick is identifying how to tell vba that's
what the user's trying to do. i tried using the ".oldvalue" feature and
testing for the starting and ending values but that didn't seemt to fit. i
found a blurb about the '.newrecord' property value in the Help
documentation....is this the way to go?