kingnothingz
Registered User.
- Local time
- Today, 07:44
- Joined
- Feb 14, 2009
- Messages
- 24
Hi All,
I have a form with 22 subforms (in about 11 tabs). Each one of these subforms has a controlling field in the main form (table) that dictates if the associated subform needs to comply with data entry rules or not.
For example:
Field in main form cboMed (Yes; No)
Subform: frmSubMeds has a list of medications
I want to be able to loop through all the records of the subform and determine if they are complete.
This check is run from a command button; that should also consider the value in the combo box. i.e. Check only if the combo has a value of "Yes"
Since i have 22 subforms and have to run the check on everyone of them, i have used the tag property to check if the record is blank or not. This is what i have so far
The problem with this is that it only looks for the selected record in the subform and doesnt look for ALL the records.
I have no idea how to proceed further, any help in this regard will be appreciated.
-kingnothingz
I have a form with 22 subforms (in about 11 tabs). Each one of these subforms has a controlling field in the main form (table) that dictates if the associated subform needs to comply with data entry rules or not.
For example:
Field in main form cboMed (Yes; No)
Subform: frmSubMeds has a list of medications
I want to be able to loop through all the records of the subform and determine if they are complete.
This check is run from a command button; that should also consider the value in the combo box. i.e. Check only if the combo has a value of "Yes"
Since i have 22 subforms and have to run the check on everyone of them, i have used the tag property to check if the record is blank or not. This is what i have so far
Code:
For Each ctl In Me.Controls
Select Case ctl.Properties("ControlType")
Case acSubform ' only look for subforms
If ctl.Enabled Then
If Not (IsNull(ctl.Properties("SourceObject"))) Then 'if it is a subform type
For Each subCtl In ctl.Form.Controls
If subCtl.ControlType = acTextBox Or subCtl.ControlType = acComboBox Then
If subCtl.Tag = "Required" And subCtl.Enabled Then
If IsNull(subCtl) Or subCtl = "" Or subCtl.Value = 0 Then
checkRecords = False
If subCtl.Controls.Count <> 0 Then
strBlank = "- " & Replace(subCtl.Controls.Item(0).Caption, ":", "") & Chr(13) & Chr(10) & strBlank
Else
strBlank = "- " & subCtl.Name & Chr(13) & Chr(10) & strBlank
End If
End If
End If
End If
Next
The problem with this is that it only looks for the selected record in the subform and doesnt look for ALL the records.
I have no idea how to proceed further, any help in this regard will be appreciated.
-kingnothingz
Last edited: