I have a form that has 8 rectangles with fields inside the rectangles.
When the user selects a category (combobox), I change the rectangle border color to blue.
I want all the other rectangle borders to be white.
When the user selects a new category, then I want the newly selected rectangle to be blue and the original one to go back to white.
The rectangle that has select a category is to remain the same at all times.
What happens is that when I select a category (bxselections), the appropriate rectangle does change to blue but when I select another category, the original rectangle and the new selected rectangle both remain blue.
Here is the code that I'm using ([[highlight #E9B96E]highlight #CC0000]the line I'm checking is CtlBorderChange)[/highlight][/highlight]
Can anyone see what I'm doing wrong??
When the user selects a category (combobox), I change the rectangle border color to blue.
I want all the other rectangle borders to be white.
When the user selects a new category, then I want the newly selected rectangle to be blue and the original one to go back to white.
The rectangle that has select a category is to remain the same at all times.
What happens is that when I select a category (bxselections), the appropriate rectangle does change to blue but when I select another category, the original rectangle and the new selected rectangle both remain blue.
Here is the code that I'm using ([[highlight #E9B96E]highlight #CC0000]the line I'm checking is CtlBorderChange)[/highlight][/highlight]
Code:
[b]combobox after update code[/b]
Select Case CmbCategory.Column(1)
Case 1 'Data Entry/CSIS
Call LockSections("DataEntryLock", True)
Call ctrlBorderChange("BxDataEntry", True)
Case 2 'Scrapped Meters
Call LockSections("ScrappedLock", True)
Call ctrlBorderChange("BxScrappedMeters", True)
...
[b]private Sub ctrlBorderChange(ctrlName As String, bchange As Boolean)[/b]
' ctrlName - string - name of control
' bChange - boolean - True if the control properties should be changed, False - no change
Call ctlBorderWhite(ctrlName, True)
If Len(globalvar) > 0 Then
Me(globalvar).BorderColor = 52479
End If
If bchange Then
Me(ctrlName).BorderColor = vbBlue
globalvar = ctrlName
g_BoxName = ctrlName
Else
globalvar = vbNullString
End If
' Call ctlBorderWhite(ctrlName, True)
End Sub
[b]Private Sub ctlBorderWhite(ctrlName As String, aChange As Boolean)[/b]'15658705 'light blue
'16777215 'white
' Debug.Print g_BoxName
For Each ctl In Me.Controls
Select Case ctl.ControlType
'Case acCheckBox, acTextBox, acComboBox, acCheckBox, acRectangle
Case acRectangle
'If ctl.Name <> g_BoxName Or ctl.Name = "bxselections" Then
'
'End If
Debug.Print ctl.Name
If aChange Then
If ctl.Name <> ctrlName Or ctl.Name <> "bxselections" Then
ctl.BackColor = 16777215 'white
Else
ctl.BackColor = 15658705 'cyan
End If
End If
End Select
Next ctl
End Sub