Access 2010: Requiring an entry in a field IF a certain selection is made from another cbobox.
Posted on 2011-09-03
In my db I have a combo box with several choices. If user selects "Current HS" , then I want to REQUIRE the field [HSGradYr] to be entered.
I have the following before update code that PARTIALLY works - but stops.
Private Sub StatusReason_BeforeUpdate(Cancel As Integer)
If Me.StatusReason = "Current HS" Then
If Len(Me.HSGradYr & vbNullString) = 0 Then
MsgBox "If you use this reason, you must enter a HS Grad Yr"
Cancel = True
When I make that selection in StatusReason, two things happen. First I get the proper message box I asked for and then this:
"Run-time error '2108'
You must save the field before you execute the GoToControl action, the GoToControl method, or the SetFocus method."
Clearly I've left something out of my code -