Help on command bar
I’m trying to execute the below code but get a type mismatch on one of the first statements, SELECT CASE COMMANDBARS("FILTER MENU").CONTROLS, I’d appreciate any thoughts, I changed the DIM statement so that CTL was a CommandBarControl and CommandBarComboBox but the same error comes up.
Dim ctl As CommandBarControls
Select Case CommandBars("Filter Menu").Controls
Case IsNull(regionCombo) = False And IsNull(managerCombo) = False
MsgBox "Provide only one value, REGION or MANAGER, not both.", vbOKOnly
DoCmd.RunMacro "mcrDeleteToolbar"
DoCmd.RunMacro "mcrCreateToolbar"
Case IsNull(regionCombo) = True
strFilter = "qryDtlMgrMth6.DirectorCode =" & Choose(regionCombo.Index, 1500, 1300, 1400, 1100, 1200) & " AND qryDtlMgrMth6.Year =" & filterYear & " AND qryDtlMgrMth6.promotionType='" & filterType & "'"
Case IsNull(managerCombo) = True
strFilter = "qryDtlMgrMth6.Code =" & Choose(managerCombo.Index, 1500, 1300, 1400, 1100, 1200) & " AND qryDtlMgrMth6.Year =" & filterYear & " AND qryDtlMgrMth6.promotionType='" & filterType & "'"
End Select
I’m trying to execute the below code but get a type mismatch on one of the first statements, SELECT CASE COMMANDBARS("FILTER MENU").CONTROLS, I’d appreciate any thoughts, I changed the DIM statement so that CTL was a CommandBarControl and CommandBarComboBox but the same error comes up.
Dim ctl As CommandBarControls
Select Case CommandBars("Filter Menu").Controls
Case IsNull(regionCombo) = False And IsNull(managerCombo) = False
MsgBox "Provide only one value, REGION or MANAGER, not both.", vbOKOnly
DoCmd.RunMacro "mcrDeleteToolbar"
DoCmd.RunMacro "mcrCreateToolbar"
Case IsNull(regionCombo) = True
strFilter = "qryDtlMgrMth6.DirectorCode =" & Choose(regionCombo.Index, 1500, 1300, 1400, 1100, 1200) & " AND qryDtlMgrMth6.Year =" & filterYear & " AND qryDtlMgrMth6.promotionType='" & filterType & "'"
Case IsNull(managerCombo) = True
strFilter = "qryDtlMgrMth6.Code =" & Choose(managerCombo.Index, 1500, 1300, 1400, 1100, 1200) & " AND qryDtlMgrMth6.Year =" & filterYear & " AND qryDtlMgrMth6.promotionType='" & filterType & "'"
End Select