Shamil Salakhetdinov
shamil at smsconsulting.spb.ru
Fri Dec 3 16:59:30 CST 2010
Yes, David, that works starting at least Access 97: In fact a Query (a Table) opened in normal view is a form instance in datasheet view. It's not listed in Forms collection but it can be accessed via Application.Screen.ActiveDatasheet object: Public Sub EnumerateQueryControls() ' Enumerate controls of a table/query ' opened in normal view Dim app As Access.Application Dim frm As Form Dim ctl As Control Set app = Access.Application Set frm = app.Screen.ActiveDatasheet.Form debug.print frm.Name For Each ctl In frm.Controls Debug.Print ctl.Name & " - " & ctl.ColumnHidden Next ctl End Sub Thank you. -- Shamil -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of David McAfee Sent: 4 ??????? 2010 ?. 1:40 To: Access Developers discussion and problem solving Subject: Re: [AccessD] Can VBA be used to "UnHide" columns in a Query inAccess2002? That is nice! It works on views in ADPs too. On Fri, Dec 3, 2010 at 1:51 PM, Shamil Salakhetdinov <shamil at smsconsulting.spb.ru> wrote: > Hi Brad, > > The following VBA code will toggle second column's visiblity: > > - On > > Screen.ActiveDatasheet.Controls(1).ColumnHidden = false > > - Off > > Screen.ActiveDatasheet.Controls(1).ColumnHidden = true > > provided your query is opened in normal view and has focus > > Thank you. > > -- > Shamil > > -----Original Message----- > From: accessd-bounces at databaseadvisors.com > [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Brad Marks > Sent: 4 ??????? 2010 ?. 0:15 > To: Access Developers discussion and problem solving > Subject: [AccessD] Can VBA be used to "UnHide" columns in a Query in > Access2002? > > Can VBA be used to "UnHide" columns in a Query in Access 2002? > > Thanks, > Brad >