Hello,
I currently have a form which contains a List Box control with abouto 10 different items. Users can select an item from the list, click a button on the form, and it outputs a datasheet (opens in .xlsx file).
This is pretty basic right now - the "On Click" property for that button uses 'Select Case' to determine which item from the List Box is selected. Then it uses DoCmd.OutputTo to open in a .xlsx file
For each 'Case', there's a different query listed (e.g.: all 10 items in the List Box have an underlying query that outputs)
Code:
DoCmd.OutputTo acOutputQuery, "qryMy_Query_1", acFormatXLSX, "query1.xlsx", True
I'd like to modify this as follows:
1) Allow users to select multiple items from the List Box (easy enough - looks like this is a property that can be updated for the List Box control)
2) If more than 1 item is selected, clicking the button on the form would output each query onto a separate worksheet on the ".xlsx" file. Thus if they select 3 out of the 10 items from the List Box, the 3 corresponding queries will output onto a single ".xlsx" file - with each one on a separate tab (worksheet).
I found the below article which covers exporting to multi-tabbed spreadsheet, though I'm struggling a bit with how to coordinate the List Box selection(s) and underlying queries.
http://justin-hampton.com/microsoft-...d-spreadsheet/
Any help would be greatly appreciated; or, if this has been covered elsewhere, please feel free to redirect me as needed.
Thanks!