troubleshooting Question

Export data from visible datasheet columns in order displayed

Avatar of Dale Fye
Dale FyeFlag for United States of America asked on
Microsoft Access
8 Comments2 Solutions497 ViewsLast Modified:
I've got a couple of forms which display data in subforms which display query results in a datasheet format.

I don't normally like datasheets, but my client has about a dozen people using this particular application, and each of them is only interested is about 10 of the 30 fields in this table.  So they wanted a way for their users to hide and rearrange the columns and the datasheet seemed like the most appropriate option.

Now they want their users to be able to export the filtered recordset that is currently displayed in the datasheet to an Excel spreadsheet, but they only want to display the fields that are visible in the subform, and they want them displayed in the column order the user has defined by dragging the columns.

So, I'm looking for a way to build a dynamic SQL string which selects only those fields that are displayed and in the order they are displayed.  I know I can use the columnHidden property of the controls collection to determine whether the column is visible or not.  But I've been unable to identify the appropriate property to loop through the collection and identify the sequence that they are displayed in, so I can build the SQL string.

Any ideas?
Join our community to see this answer!
Unlock 2 Answers and 8 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 8 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros