I am trying to fix the following VBA code from an MS Access database I
inherited.
I conclude with an example of one of the symptoms resulting from this
VBA code:
Option Compare Database
Option Explicit
Private Sub Check13_AfterUp date()
If Me![Check13] Then
Me![Combo3].Enabled = False
Me![Combo9].Enabled = False
Me![Chicago Zip].Enabled = True
Else
Me![Combo3].Enabled = True
Me![Combo9].Enabled = True
Me![Chicago Zip].Enabled = False
End If
End Sub
Private Sub ToggleLink_Clic k()
' Me![Combo3] County
' Me![Combo9] Category
Me.Requery
If Me.NewRecord Or (Me![Check13] And IsNull(Me![Combo3]) And IsNull(Me!
[Combo9])) Or _
(Me![Check13] And IsNull(Me![Chicago Zip]) And
IsNull(Me![Combo9])) Then
Forms![Sub: Agency Lookup].DataEntry = True
Else
If Me![Check13] Then
If IsNull(Me![Combo9]) Then
Forms![Sub: Agency Lookup].RowSource = "qry Agencies by Zip"
ElseIf IsNull(Me![Chicago Zip]) Then
DoCmd.OpenForm "Sub: Agency Lookup by Category", , , ""
Else
DoCmd.OpenForm "Sub: Agency Lookup by Zip Category", , , ""
End If
Else
If IsNull(Me![Combo9]) Then
DoCmd.OpenForm "Sub: Agency Lookup by County", , , ""
ElseIf IsNull(Me![Combo3]) Then
DoCmd.OpenForm "Sub: Agency Lookup by Category", , , ""
Else
DoCmd.OpenForm "Sub: Agency Lookup by County Category", , , ""
End If
End If
End If
End Sub
I have two drop down boxes, for the fields "County" and "Category" on
a form which when selected for the respective County and Category
will
return Agency Names of Agencies within the respective County and
Category.
For example, when I select Cook County and Cardiovascular disease I
expect the query(ies) behind the form to return Names of Agencies in
Cook County that provide services regarding Cardiovascular care.
However, what is returned are Names of Agencies outside of the county
and category selected.
Any advice on where to begin?
Thank you!,
John
inherited.
I conclude with an example of one of the symptoms resulting from this
VBA code:
Option Compare Database
Option Explicit
Private Sub Check13_AfterUp date()
If Me![Check13] Then
Me![Combo3].Enabled = False
Me![Combo9].Enabled = False
Me![Chicago Zip].Enabled = True
Else
Me![Combo3].Enabled = True
Me![Combo9].Enabled = True
Me![Chicago Zip].Enabled = False
End If
End Sub
Private Sub ToggleLink_Clic k()
' Me![Combo3] County
' Me![Combo9] Category
Me.Requery
If Me.NewRecord Or (Me![Check13] And IsNull(Me![Combo3]) And IsNull(Me!
[Combo9])) Or _
(Me![Check13] And IsNull(Me![Chicago Zip]) And
IsNull(Me![Combo9])) Then
Forms![Sub: Agency Lookup].DataEntry = True
Else
If Me![Check13] Then
If IsNull(Me![Combo9]) Then
Forms![Sub: Agency Lookup].RowSource = "qry Agencies by Zip"
ElseIf IsNull(Me![Chicago Zip]) Then
DoCmd.OpenForm "Sub: Agency Lookup by Category", , , ""
Else
DoCmd.OpenForm "Sub: Agency Lookup by Zip Category", , , ""
End If
Else
If IsNull(Me![Combo9]) Then
DoCmd.OpenForm "Sub: Agency Lookup by County", , , ""
ElseIf IsNull(Me![Combo3]) Then
DoCmd.OpenForm "Sub: Agency Lookup by Category", , , ""
Else
DoCmd.OpenForm "Sub: Agency Lookup by County Category", , , ""
End If
End If
End If
End Sub
I have two drop down boxes, for the fields "County" and "Category" on
a form which when selected for the respective County and Category
will
return Agency Names of Agencies within the respective County and
Category.
For example, when I select Cook County and Cardiovascular disease I
expect the query(ies) behind the form to return Names of Agencies in
Cook County that provide services regarding Cardiovascular care.
However, what is returned are Names of Agencies outside of the county
and category selected.
Any advice on where to begin?
Thank you!,
John
Comment