Resolved
Thanks to NeoPa, OldBirdman & FishVal's suggestions, I was able to get a resolution to my VBA code issue for Excel.
The original question was how do you "Close DropDown of Cbo2 & Open Cbo1 on Error"? I resolved this by disabling Cbo2 (Enabled = False), until a selection is made in Cbo1.
To resolve the Run-time errors, I used "On Error Resume Next" and "On Error...
User Profile
Collapse
-
NeoPa,
Yes, there is a collection of Sheets and PivotTables in the WorkBook.
SALES DATA (sheet1) - final data imported from Access.
FORM (sht2) w/Active CboBoxes.
PIVOT (sht7) - sample sheet.
PIVOT CHART (sht8) - sample sheet.
(multiple user PivotTables)
Hidden data sheets for Cbos - imported from Access on requery
DEPT (sht3) for cbo1.ListFillRa nge
CAT (sht4)...Leave a comment:
-
NeoPa,
Thank you for your suggestion. However, a loop will not work. Because the end user may add several new Pivots & PivotCharts. The reason of the RefreshAll".
I'm providing the user with an on demand refreshable data sheet(s) via an MSAccess connection. The Form (sheet1) has Cascading CboBoxes to aid in the filtering of the inbound data.
Thanks, KevinLeave a comment:
-
Is it possible to disable sheet1 from being Refreshed by an ActiveWorkbook. RefreshAll?
It would resolve the Run-time error in the cbo.Click sub for sheet1. I don't want it to distrub the CboBoxes anyway.
I only want the ActiveWorkbook. RefreshAll to Refresh the data/Pivot sheets.Leave a comment:
-
Cascading CombBoxes - Cbo.Enable = True/False - Error on RefreshAll
Instead of the MouseDown sub, I tried a Change sub with a Cbo.Enable = True/False to disable and enable the proceeding Active ComboBoxes. It works great for the Cascading Dropdowns.
However I’m getting a “Run-time error 1004” on the Enable = True/False, from my CmdButton sub “CmdRefreshAll_ Click” (see 2nd sub below). It has an ActiveWorkbook. RefreshAll....Leave a comment:
-
For Cascading Combo/List Boxes, try a Requery in an AfterUpdate sub (Event Procedure).
Private Sub Cbo1_AfterUpdat e()
'This will requery ComboBoxes 2 and 3
Me.Cbo2.Requery
Me.Cbo3.Requery
End Sub
For Cbo2 Data, Row Source Type Table/Query, Row Source:
SELECT DISTINCT [your_table].[field2]
FROM [your_table]
WHERE ((([your_table].[field1]) Like [Forms]![your_form]![Cbo1]))...Leave a comment:
-
Close DropDown of ComboBox2 & Open ComboBox1 on Error
I have several cascading ComboBoxes & would like to close Cbo2 & open Cbo1
when there is an error. These CboBoxes are on an Excel spreadsheet, not a UserForm.
I have the following code, if the Dropdown is opened it requeries Cbo2 to
ListIndex = 0. But I also want it to close (unselect, undrop list) Cbo2 &
open (select, dropdown) Cbo1 on MsgBox error. This insures the user selects
property...
No activity results to display
Show More
Leave a comment: