Databases Reference
In-Depth Information
The next two subroutines update the fields should a condition be enabled. They also enable/dis-
able all conditional controls pertaining to a specific condition depending on the status change of
the condition. This code works because the form was designed such that all objects associated with
condition 1 have ā€œ1eā€ within their name, and all objects associated with condition 2 have ā€œ2eā€
within their name.
Private Sub Check_Cond1_Click()
Dim C As Control, State As Boolean
If frm7Access.Check_Cond1.value = True Then State = True Else
State = False
For Each C In Controls
If C.Name Like "*1e*" Then
C.Enabled = State
End If
Next C
If frm7Access.Check_Cond1.value = True Then Call
PopulateFields(frm7Access.ComboBox_Tables.Text)
End Sub
Private Sub Check_Cond2_Click()
Dim C As Control, State As Boolean
If frm7Access.Check_Cond2.value = True Then State = True Else
State = False
For Each C In Controls
If C.Name Like "*2e*" Then
C.Enabled = State
End If
Next C
If frm7Access.Check_Cond2.value = True Then Call
PopulateFields(frm7Access.ComboBox_Tables.Text)
End Sub
The next subroutine will clear every Combo Box within the form that holds Field information
about the selected Table of interest. This subroutine is possible because the forethought was put
into designing the form such that all Combo Boxes holding Field names contained the word Field
within the name.
Sub ClearFields()
'This will clear every ComboBox in the active GUI which holds
Table Field information
Dim C As Control
For Each C In Controls
If TypeOf C Is ComboBox And C.Name Like "*Field*" Then
C.Clear
End If
Next C
End Sub
Search WWH ::




Custom Search