ReliableEngineer
New Member
- Joined
- Oct 26, 2017
- Messages
- 3
Hey there people,
I am working on a userform to monitor repeat defects on our fleet of aircraft. I want this form to display the defect information in listbox2 when you select the appropriate watchlist item in listbox1.
So far I am stuck on making listbox1 display all items on the "Register' worksheet. I need to figure how to show only the Fleet type, Registration or ATA combobox search options, but that's for a future thread. Here I only want to see the defect info in listbox2 when I make a selection in listbox1.
Could someone please help?
Cheers.
Here is my code so far:
I am working on a userform to monitor repeat defects on our fleet of aircraft. I want this form to display the defect information in listbox2 when you select the appropriate watchlist item in listbox1.
So far I am stuck on making listbox1 display all items on the "Register' worksheet. I need to figure how to show only the Fleet type, Registration or ATA combobox search options, but that's for a future thread. Here I only want to see the defect info in listbox2 when I make a selection in listbox1.
Could someone please help?
Cheers.
Here is my code so far:
Code:
Private Sub UserForm_Initialize()
'Empty RegoComboBox
RegoComboBox.Clear
'Fill RegoCombobox
Me.RegoComboBox.List = Worksheets("Data").Range("B2:B54").Value
'Empty FleetTypeComboBox
FleetTypeComboBox.Clear
'Fill FleetTypeCombobox
Me.FleetTypeComboBox.List = Worksheets("Data").Range("D2:D7").Value
'Empty ActiveRWLItemsListBox
ActiveRWLItemsListBox.RowSource = ""
'Empty ActiveRWLItemsListBox
ActiveRWLItemsListBox.Clear
'Empty ATAComboBox
ATAComboBox.Clear
'Fill ATAComboBox
Me.ATAComboBox.List = Worksheets("Data").Range("C2:C38").Value
'Uncheck DataCheckBoxes
IncludeClosedCheckBox.Value = False
'Set Focus on FleetTypeComboBox
FleetTypeComboBox.SetFocus
End Sub
Private Sub SearchActiveCommandButton_Click()
Dim i As Long
Dim n As Long
Dim Str As String
Str = Me.RegoComboBox.Value
n = Me.ActiveRWLItemsListBox.ListCount
For i = 0 To n - 1
If Left(Me.ActiveRWLItemsListBox.List(i), Len(Str)) = Str Then
Me.ActiveRWLItemsListBox.ListIndex = i
Exit Sub
End If
Next i
ActiveRWLItemsListBox.RowSource = Range("ActiveRWLItems").Address
ListFilter = "Select [RegoData].[RegoData] " & _
"FROM RegoData" & _
"WHERE [RegoData].[ReportFleetType] = '" & Me.FleetTypeComboBox.Value & "'"
End Sub
Last edited by a moderator: