Split up code into 2 events

C

Carrie

I got help with this a few weeks ago here on this site but being terrible at
code, I can't seem to figure out how to split it up to achieve the results I
want. Basically I have a Main Form with a number of Subforms set up on tabs.
The User wants each tab to be colored red if there is data in it. Through
advice here, I made the tabs invisible and set up an option group of toggle
buttons.

When the user clicks on a button it takes them to the appropriate
tab/subform and changes to a red font if there is already data in that
subform. Better than nothing but it means that the user has to click on
every button to see which subforms contain data for this record.

What I actually need to happen is that On Load or On Open, the buttons
change color if there is data but I still need the On Click event for the
User to get to the subform. Can someone please tell me how to change this to
two events? As always, thanks in advance!



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", "Qry_Abandonments", "RecordID=" & Me.Record_ID),
0)
If x > 0 Then
Me.Tog_Abd.ForeColor = vbRed
Else
Me.Tog_Abd.ForeColor = vbBlack
End If
etc.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top