Question

In Microsoft Access 2007, in the VBA Code, one can know the Object selected through a single-click in the Navigation Pane by:

dim strObjName as String, lObjType as Long
strObjName = Application.CurrentObjectName
lObjType = Application.CurrentObjectType

Only a single object can be selected in this way.

Now I want to select multiple objects, for example, to export several selected tables from the backend SQL Server that is used for our physical store managing, as .sql text files to create MySQL tables for website usage.

Here is the screenshot: In the Navigation Pane, try to get the selected objects marked by brown bg color.

screenshot

My question is, in Visual Basic for Application, how to get the list of objects selected in the navigation pane through Shift-Click, so several objects are simultaneously selected, as shown in fig., that Access 2007 marks by brown background color, in a way like:

dim xObjs
Set xObjs = Application.SelectedObjects ' this property does not exist.

?

Was it helpful?

Solution

I don't believe there's a collection object for the Navigation bar, which would probably be your only hope in this case.

I suggest you create your own form with a multi-select listbox, fill it out with your Query objects when the form loads, and then write code to loop through the listbox and export the selected items.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top