T
Tom
Graham Mandeno (MVP) helped me out w/ the CASE statement below (which works
fine).
However, I now realize that I have 2 more questions though ... hopefully
someone can help me out and provide me some pointers.
Below is the code I currently have (I added a bunch of requeries...)
Essentially, I have a bunch of "boxes" on a form (no text -- they are the
basis for a Balanced Scorecard) which colors tell the users where "attention
needs to be paid".
For testing purposes, I have a subform where I change the value. In this
subform I want the color changes appears immediately and also tab from one
textbox to the next.
My 2 questions are below the VBA code:
*******************
Option Compare Database
Private Sub SetColors(c As Control)
Select Case c
Case Is = 0: c.BackColor = 16777215 'white
Case Is <= 25: c.BackColor = 255 'red
Case Is <= 50: c.BackColor = 33023 'orange
Case Is <= 75: c.BackColor = 65535 'yellow
Case Is <= 100: c.BackColor = 32768 'green
Case Else: c.BackColor = 8421504 'gray
End Select
End Sub
Private Sub Form_Current()
SetColors Q1D11
SetColors Q2D11
SetColors Q3D11
SetColors Q4D11
SetColors Q1D12
SetColors Q2D12
SetColors Q3D12
SetColors Q4D12
End Sub
Private Sub Q1D11_AfterUpdate()
Me.Requery
End Sub
Private Sub Q2D11_AfterUpdate()
Me.Requery
End Sub
Private Sub Q3D11_AfterUpdate()
Me.Requery
End Sub
Private Sub Q4D11_AfterUpdate()
Me.Requery
End Sub
Private Sub Q1D12_AfterUpdate()
Me.Requery
End Sub
Private Sub Q2D12_AfterUpdate()
Me.Requery
End Sub
Private Sub Q3D12_AfterUpdate()
Me.Requery
End Sub
Private Sub Q4D12_AfterUpdate()
Me.Requery
End Sub
*******************
Q1:
Is there a better way to write a REQUERY once instead of putting it into
each individual textbox? I might end up w/ 200 boxes once the Balanced
Scorecard is complete... having the same 3 lines of code seems to be insane.
Q2:
As of now, the REQUERY for the 8 boxes works fine, but the TAB works little
bit strange now.
For instance, when I update the 2nd box (Q2D11 = Quarter 2; Priority "1.1")
and then press TAB, it won't go to "Q3D11". Instead, it jumps back to
"Q1D11".
So, each time I changed a value, I start from the entire beginning using the
TAB. Is there a way to simply just move to the next box?
Thanks,
Tom
fine).
However, I now realize that I have 2 more questions though ... hopefully
someone can help me out and provide me some pointers.
Below is the code I currently have (I added a bunch of requeries...)
Essentially, I have a bunch of "boxes" on a form (no text -- they are the
basis for a Balanced Scorecard) which colors tell the users where "attention
needs to be paid".
For testing purposes, I have a subform where I change the value. In this
subform I want the color changes appears immediately and also tab from one
textbox to the next.
My 2 questions are below the VBA code:
*******************
Option Compare Database
Private Sub SetColors(c As Control)
Select Case c
Case Is = 0: c.BackColor = 16777215 'white
Case Is <= 25: c.BackColor = 255 'red
Case Is <= 50: c.BackColor = 33023 'orange
Case Is <= 75: c.BackColor = 65535 'yellow
Case Is <= 100: c.BackColor = 32768 'green
Case Else: c.BackColor = 8421504 'gray
End Select
End Sub
Private Sub Form_Current()
SetColors Q1D11
SetColors Q2D11
SetColors Q3D11
SetColors Q4D11
SetColors Q1D12
SetColors Q2D12
SetColors Q3D12
SetColors Q4D12
End Sub
Private Sub Q1D11_AfterUpdate()
Me.Requery
End Sub
Private Sub Q2D11_AfterUpdate()
Me.Requery
End Sub
Private Sub Q3D11_AfterUpdate()
Me.Requery
End Sub
Private Sub Q4D11_AfterUpdate()
Me.Requery
End Sub
Private Sub Q1D12_AfterUpdate()
Me.Requery
End Sub
Private Sub Q2D12_AfterUpdate()
Me.Requery
End Sub
Private Sub Q3D12_AfterUpdate()
Me.Requery
End Sub
Private Sub Q4D12_AfterUpdate()
Me.Requery
End Sub
*******************
Q1:
Is there a better way to write a REQUERY once instead of putting it into
each individual textbox? I might end up w/ 200 boxes once the Balanced
Scorecard is complete... having the same 3 lines of code seems to be insane.
Q2:
As of now, the REQUERY for the 8 boxes works fine, but the TAB works little
bit strange now.
For instance, when I update the 2nd box (Q2D11 = Quarter 2; Priority "1.1")
and then press TAB, it won't go to "Q3D11". Instead, it jumps back to
"Q1D11".
So, each time I changed a value, I start from the entire beginning using the
TAB. Is there a way to simply just move to the next box?
Thanks,
Tom