For Toppers
Hi Toppers,
It is all working now but I have placed the code for the 'ComboBoxActivity'
below, this code populates from TextBox3. The difficulty was that (a) the
available list for 'ComboBoxOffence' had to relate to the 'UNIT' in
'TextBox3' and the Activity in 'ComboBoxActivity'. A workaround using help
from in the States has evolved the code below, I am sure this can be
tightened up but it is working at the moment so there is progress!. One
later issue will be that I will want to calculate the Sanctioned Detections
etc. on a Monthly basis but this format will give me different values for
X.Sanctioned Detections and R.Sanctioned Detections etc. I am hoping that I
can add the two values together for one monthly chart and have bought John
Walkenbach's Excel 2003 Formulas book to help out.
As an aside, can you tell me how I simply populate a ComboBox from a range
of values, I have tried -
ControlBox1.List = Array("A Div", "B Div", "C Div") but that did not work, I
added it to ControlBox1_Change()
but that failed. Here is the code to drive ComboBoxActivity -
================================================== =========================
Private Sub LoadActivityDropdown()
Dim FoundCell As Range
Dim Rng As Range
Dim UnitTxt As String
UnitTxt = Me.TextBox3.Text
Set FoundCell = Range("UnitTypeList").Find(what:=UnitTxt,
after:=Range("UnitTypeList")(1, 1), lookat:=xlWhole, MatchCase:=False)
If Not FoundCell Is Nothing Then
With Me.ComboBoxActivity
.Clear
Select Case FoundCell.Text
Case "RPU 1", "RPU 2", "RPU 3", "RPU 4", "RPU 5"
.AddItem "R.Sanctioned Detection"
.AddItem "R.Other Arrest"
.AddItem "R.Roads Policing"
.AddItem "R.Speeding"
.AddItem "R.ANPR Other"
.AddItem "R.POMAN Other"
Case "RPU 6", "RPU 7", "Enforcement"
.AddItem "Sanctioned Detection"
.AddItem "X.Other Arrest"
.AddItem "X.Roads Policing"
.AddItem "X.Speeding"
.AddItem "X.ANPR Other"
.AddItem "X.POMAN Other"
Case "TVCU"
.AddItem "T.Sanctioned Detection"
.AddItem "T.Other Arrest"
.AddItem "T.POMAN Other"
Case "MetroLink"
.AddItem "M.Sanctioned.Detection"
.AddItem "M.Other Arrest"
.AddItem "M.POMAN Other"
.AddItem "M.Visibility"
Case "Traffic Warden"
.AddItem "W.Speeding"
.AddItem "W.POMAN Other"
.AddItem "W.Visiblity"
Case "Investigation", "OPU", "TMU", "Policy Unit", "Accident
Records", "Camera Enforcement", "NRSI", "Admin"
.AddItem "Not Applicable"
Case Else
End Select
End With
End If
End Sub
================================================== ===================================
Regards,
Mickey
|