C
Carrie
I have a current post going for this but I think I may have exhausted my
expert and it's getting a bit confusing.
What I have is a Main Form. In the detail is an option group (toggle
buttons) to go to the various tabs which each have a subform. Each subform
has a unique primary key but is also linked to the Main Form by Record_ID.
I need the toggle buttons to appear with red font if the particular Record
in the main form that the user is on has data in the subform that the toggle
button goes to.
The code so far is below but what it does is once I click on the toggle
button for the first time, it turns red and stays red no matter what record I
go to. I believe that it is thinking that there is data in the subtable (vs.
the specific record). I think I need some criteria in the DCount but I can't
figure out what! I have tried all sorts of things with the Record_ID and the
subtable ID's to no avail. I also think I may need a Refresh or Requery?
Any help you can give is much appreciated!
Private Sub Toggle_Tabs_Click()
Dim x As Integer
x = 0
Select Case Toggle_Tabs.Value
Case 1
Me!TABS.Value = 0
x = Nz(DCount("Aband_ID", "Subtbl_Abandonments"), 0)
If x > 0 Then
Me.Tog_Abd.ForeColor = vbRed
Else
Me.Tog_Abd.ForeColor = vbBlack
End If
Case 2
Me!TABS.Value = 1
x = Nz(DCount("D13_ID", "Subtbl_D13_MAIN"), 0)
If x > 0 Then
Me.Tog_D13.ForeColor = vbRed
Else
Me.Tog_D13.ForeColor = vbBlack
End If
etc......
End Select
End Sub
expert and it's getting a bit confusing.
What I have is a Main Form. In the detail is an option group (toggle
buttons) to go to the various tabs which each have a subform. Each subform
has a unique primary key but is also linked to the Main Form by Record_ID.
I need the toggle buttons to appear with red font if the particular Record
in the main form that the user is on has data in the subform that the toggle
button goes to.
The code so far is below but what it does is once I click on the toggle
button for the first time, it turns red and stays red no matter what record I
go to. I believe that it is thinking that there is data in the subtable (vs.
the specific record). I think I need some criteria in the DCount but I can't
figure out what! I have tried all sorts of things with the Record_ID and the
subtable ID's to no avail. I also think I may need a Refresh or Requery?
Any help you can give is much appreciated!
Private Sub Toggle_Tabs_Click()
Dim x As Integer
x = 0
Select Case Toggle_Tabs.Value
Case 1
Me!TABS.Value = 0
x = Nz(DCount("Aband_ID", "Subtbl_Abandonments"), 0)
If x > 0 Then
Me.Tog_Abd.ForeColor = vbRed
Else
Me.Tog_Abd.ForeColor = vbBlack
End If
Case 2
Me!TABS.Value = 1
x = Nz(DCount("D13_ID", "Subtbl_D13_MAIN"), 0)
If x > 0 Then
Me.Tog_D13.ForeColor = vbRed
Else
Me.Tog_D13.ForeColor = vbBlack
End If
etc......
End Select
End Sub