i have a datasheet. when the user doubleclicks on the member number, another form opens where the user can enter details about the member. when the user goes to the next member number on the datasheet, the detail form closes. when she double clicks the member number, it opens with the second member's info.
my question is: on the details form, i have some fields that must be filled if one of the fields has a certain value. (if [attempt] = "call back later" then user must fill in a call back time) i want to make sure that the user fills it in.
so far i have tried:
Private Sub Form_Close()
If Me.attempt = "call back later" And IsNull(Me.[attempt_call_back date]) Then
MsgBox "You must enter a call back date.", vbOKOnly, "Call Back details"
DoCmd.GoToControl "attempt_call_back date"
Exit Sub
End If
the MSgbox comes us, it quickly goes to the correct field and then quickly closes the form.
i tried putting this code behind the [member number] field:
If IsFormOpen("details") = True Then
If Forms![details]![attempt] = "call back later" And IsNull(Forms![details]![attempt_call_back_date]) Then
MsgBox "You must enter a call back date.", vbOKOnly, "Call Back details"
Forms![details].[attempt_call_back_date].SetFocus
Else
DoCmd.Close acForm, "details", acSaveYes
End If
End If
this works as far as not closing the details form, but the cursor does not blink in the [attempt_call_back_date] field AND if the user closes the details form with the X, i cannot make sure that the info is entered.
how can i make sure that the user enters all necessary info before the form closes?
my question is: on the details form, i have some fields that must be filled if one of the fields has a certain value. (if [attempt] = "call back later" then user must fill in a call back time) i want to make sure that the user fills it in.
so far i have tried:
Private Sub Form_Close()
If Me.attempt = "call back later" And IsNull(Me.[attempt_call_back date]) Then
MsgBox "You must enter a call back date.", vbOKOnly, "Call Back details"
DoCmd.GoToControl "attempt_call_back date"
Exit Sub
End If
the MSgbox comes us, it quickly goes to the correct field and then quickly closes the form.
i tried putting this code behind the [member number] field:
If IsFormOpen("details") = True Then
If Forms![details]![attempt] = "call back later" And IsNull(Forms![details]![attempt_call_back_date]) Then
MsgBox "You must enter a call back date.", vbOKOnly, "Call Back details"
Forms![details].[attempt_call_back_date].SetFocus
Else
DoCmd.Close acForm, "details", acSaveYes
End If
End If
this works as far as not closing the details form, but the cursor does not blink in the [attempt_call_back_date] field AND if the user closes the details form with the X, i cannot make sure that the info is entered.
how can i make sure that the user enters all necessary info before the form closes?