D
dsc2bjn
I have created a form and wish to validate entries within the form and a
subform.
I have placed the form validation code as part of the "Close" button.
Example:
If (Eval("[Forms]![frmOther Weakness Corrective Actions (New Entry)]![OCD]
is Null")) Then
MsgBox "A Value for 'Estimated Completion Date' is Required.", vbOKOnly,
"Required Value Missing"
intIsError = 1
End If
I now wish to validate entries on the subform. I tried calling the
"[subForm]", but get an error saying basically the method does not exist.
How can I validate the subform entries?
Also, I wish to spell check the form and subform. I can spell check the
form, but the subform is ignored.
Dim ctlSpell As Control
Dim frm As Form
Set frm = Screen.ActiveForm
DoCmd.SetWarnings False
For Each ctlSpell In frm.Controls
If TypeOf ctlSpell Is TextBox Then
If Len(ctlSpell) > 0 Then
With ctlSpell
'only spell check the text boxes with a value of true in
their tag property.
If .Tag = "True" Then
.SetFocus
.SelStart = 0
.SelLength = Len(ctlSpell)
DoCmd.RunCommand acCmdSpelling
End If
End With
End If
End If
Next
MsgBox "Spell check complete.", vbInformation + vbOKOnly, "Finished."
DoCmd.SetWarnings True
DoCmd.Close
End If
subform.
I have placed the form validation code as part of the "Close" button.
Example:
If (Eval("[Forms]![frmOther Weakness Corrective Actions (New Entry)]![OCD]
is Null")) Then
MsgBox "A Value for 'Estimated Completion Date' is Required.", vbOKOnly,
"Required Value Missing"
intIsError = 1
End If
I now wish to validate entries on the subform. I tried calling the
"[subForm]", but get an error saying basically the method does not exist.
How can I validate the subform entries?
Also, I wish to spell check the form and subform. I can spell check the
form, but the subform is ignored.
Dim ctlSpell As Control
Dim frm As Form
Set frm = Screen.ActiveForm
DoCmd.SetWarnings False
For Each ctlSpell In frm.Controls
If TypeOf ctlSpell Is TextBox Then
If Len(ctlSpell) > 0 Then
With ctlSpell
'only spell check the text boxes with a value of true in
their tag property.
If .Tag = "True" Then
.SetFocus
.SelStart = 0
.SelLength = Len(ctlSpell)
DoCmd.RunCommand acCmdSpelling
End If
End With
End If
End If
Next
MsgBox "Spell check complete.", vbInformation + vbOKOnly, "Finished."
DoCmd.SetWarnings True
DoCmd.Close
End If