Hi,
I am making a form at work for a coworker with cascading combo/list boxes where she can select a Customer, then Platform Description, then Period, then Year. I used VBA code for this and it's working perfectly - for single selection.
I want to update this so she can select multiple Platform Descriptions and/or Periods and it will give all the applicable info.
Can someone show me if there is a certain code I can use or a way to set up a query, etc. so that multi-select will work for me? Unfortunately, just changing the formatting to multiselect makes the listbox just blank white, so I'm assuming it's going to be more complicated. I'm new at Access, so hang in there with me!
Thank you!
(Here's the code I currently have for the cascading combo/list boxes, if you need it.
SD0039DA_T is the table name where my listboxes are pulling info from.)
I am making a form at work for a coworker with cascading combo/list boxes where she can select a Customer, then Platform Description, then Period, then Year. I used VBA code for this and it's working perfectly - for single selection.
I want to update this so she can select multiple Platform Descriptions and/or Periods and it will give all the applicable info.
Can someone show me if there is a certain code I can use or a way to set up a query, etc. so that multi-select will work for me? Unfortunately, just changing the formatting to multiselect makes the listbox just blank white, so I'm assuming it's going to be more complicated. I'm new at Access, so hang in there with me!
Thank you!
(Here's the code I currently have for the cascading combo/list boxes, if you need it.
SD0039DA_T is the table name where my listboxes are pulling info from.)
Code:
Option Compare Database
Private Sub Form_Load()
On Error Resume Next
CustomerCB.SetFocus
PlatformDescriptionL.Enabled = False
PeriodL.Enabled = False
YearCB.Enabled = False
End Sub
Private Sub CustomerCB_AfterUpdate()
On Error Resume Next
PlatformDescriptionL.Enabled = True
PlatformDescriptionL.RowSource = "Select distinct PlatformDescription " & _
"FROM SD0039DA_T " & _
"WHERE CustomerName = '" & CustomerCB & "' " & _
"ORDER BY PlatformDescription"
PlatformDescriptionL.SetFocus
PeriodL.Enabled = False
PeriodL.RowSource = "Select distinct Period " & _
"FROM SD0039DA_T " & _
"WHERE CustomerName = '" & CustomerCB & "' " & _
"ORDER BY Period"
PeriodL.SetFocus
YearCB.Enabled = False
YearCB.RowSource = "Select distinct BillingYear " & _
"FROM SD0039DA_T " & _
"WHERE CustomerName = '" & CustomerCB & "' AND " & _
"PlatformDescription = '" & PlatformDescriptionL & "' AND " & _
"Period = " & PeriodL & " " & _
"ORDER BY BillingYear"
YearCB.SetFocus
End Sub
Private Sub PlatformDescriptionL_AfterUpdate()
On Error Resume Next
PeriodL.Enabled = True
PeriodL.RowSource = "Select distinct Period " & _
"FROM SD0039DA_T " & _
"WHERE CustomerName = '" & CustomerCB & "' AND " & _
"PlatformDescription = '" & PlatformDescriptionL & "' " & _
"ORDER BY Period"
PeriodL.SetFocus
YearCB.Enabled = False
YearCB.RowSource = "Select distinct BillingYear " & _
"FROM SD0039DA_T " & _
"WHERE CustomerName = '" & CustomerCB & "' AND " & _
"PlatformDescription = '" & PlatformDescriptionL & "' AND " & _
"Period = " & PeriodL & " " & _
"ORDER BY BillingYear"
YearCB.SetFocus
End Sub
Private Sub PeriodL_AfterUpdate()
On Error Resume Next
YearCB.Enabled = True
YearCB.RowSource = "Select distinct BillingYear " & _
"FROM SD0039DA_T " & _
"WHERE CustomerName = '" & CustomerCB & "' AND " & _
"PlatformDescription = '" & PlatformDescriptionL & "' AND " & _
"Period = " & PeriodL & " " & _
"ORDER BY BillingYear"
YearCB.SetFocus
End Sub
Private Sub RunReportButton_Click()
End Sub