Full Version: forcing response in a form
UtterAccess Discussion Forums > Microsoft® Access > Access Forms
yellowcabguy
Have a series of things I am going to try and store (among others)

Medical Needs (Y/N)

Type of Medical Needs (from drop down)

Medical Comments (text)


If the input to "Medical Needs" is YES is there a way to haver ACCESS require/force me to have a response in the "Type of Medical Need" control/field? (force me to select from th drop down menu)

If the input in "Medical Needs" is not I can skip to the next input box on the form.(bupass "Type" and "Comments"

Thanks
kbrewster
You could check the field before the user closes the form...

If Me.MedicalNeeds = True Then
If IsNull(Me.TypeofMedicalNeeds) Then
Msgbox "Type of Medical Needs is a required field!"
Else
Docmd.Close
End IF
Else
Docmd.Close
End If
TerryL
Alternatively, if you wanted to trap this before the User closes the form, do something like

In the AfterUpdate event of the Medical Needs check box:
if me.medicalneeds = -1 then

Force the cursor in to your combo box
me.TypeOfMedicalNeeds.SetFocus
endif

And in the Exit event of your Type Of Medical Needs combo:
If isnull(me.cboTypeOfNeed) then
msgbox "You must select a MedicalNeed",vbCritical

Cancel the Exit event so that the cursor stays in your combo box

docmd.CancelEvent
endif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.