I'm having issues setting up validation checks on this form.
For the two tables that were used to create the mainform/subform, I have set all data fields to 'required.'
What I want to do is ensure that the user inputs all data on the main form, and has at least one filled field in the FiscalYears subform.
My Code so far looks like this:
Code:
Private Sub cmdSave_Click()
On Error GoTo Err_cmdSave_Click
If CStr(Me!Child86.Form!FYSummary.Value) <> "" Then 'Child86 is the name of the control that houses/contains the subform in my mainform. It was 'automatically generated by Access
Debug.Print CStr(Me!Child86.Form!FYSummary.Value)
MsgBox "Save Succeeded."
DoCmd.RunCommand acCmdSaveRecord
MsgBox "Record was Saved."
Else
MsgBox "Please make sure that there is at least one corresponding entry in the Fiscal Years table on the right side of the form."
Exit Sub
End If
Err_cmdSave_Click:
If Err.Number <> 0 Then
MsgBox Err.Number & ": " & Err.Description
MsgBox "Record encountered an error."
'Resume cmdSave_Click
End If
End Sub
Any Advice?
Sometimes it will work, and othertimes it will not. See the screenshot for two instances:
It behaves differently depending on if i remove/add/click in or out of the box, etc.