I have a field (dropdown) that must be populated before moving off the record. Where do I put the code? I had it on Unload of the form, but that doesn't catch the empty field when moving to the next record.
I have this code in On Unload
If Me.cboStatus = "J" And IsNull(cboDA.Column(1)) Then
MsgBox "Please Enter The Juvenile's Current Dorm Assignment, or select 'Unknown'."
cancel = true
I assume I need the same code (minus the cancel=true) somewhere else for when the form is not closed.. but the user clicks new record or next record, etc..
Help is appreciated!
Originally posted by tessie
I set the field as required in the table. When I add a record without keying to the required field.. it proceeds as normal... but it doesn't save the record.
I need more details on what to do. They move off of the record by one of several ways.
1. The record selector
2. the Create New button
3. closing the form
I may make it simple and do as suggested.. default to Unknown.. if they don't change that.. they will get lots of Unknowns on their report.. not my problem.
you can put the code
if combo.value = "Unknown" then
unknownmsg =MsgBox("Unknown Datatype", vbOKCancel, "Unknown Data")
if vbcancel then
else docmd.close acform "FormName"
in the on close of form and on the on click of the cmd button.
The only way i know how to get that command in the record selection is to creat all of those buttons and then put this in with that code
the easiest way to do it would default it and let them deal with it.
hope this give you an idea