ghudson
Registered User.
- Local time
- Today, 05:29
- Joined
- Jun 8, 2002
- Messages
- 6,194
I am trying to use Bob Larson’s excellent Export A Form's Recordset To Excel code. It works of course, but I am using a datasheet view in my subform and I am hiding columns based on the users selection. I only want to export the visible recordset from the subform. There are over fifty possible fields but the user might only select a few fields to query and the user will not want all the data fields exported. Bob’s code exports the filtered data but it also exports all the data fields. Anyway to tweak Bob’s code to do what it does but only export the visible fields?
Below is the code I am using to hide the columns when the subform is opened…
Thanks in advance for your help!
Below is the code I am using to hide the columns when the subform is opened…
Code:
Dim ctl As Control
For Each ctl In Me.Controls
If ctl.ControlType = acTextBox Then
If DLookup("[InUse]", "tblFields", "FieldName = '" & ctl.Name & "'") = -1 Then
ctl.ColumnHidden = False
Else
ctl.ColumnHidden = True
End If
End If
Next