John Skolits
askolits at ot.com
Fri Mar 30 13:41:31 CDT 2007
OK, Thanks for the code. That'll come in handy. John Skolits -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Shamil Salakhetdinov Sent: Friday, March 30, 2007 2:15 PM To: 'Access Developers discussion and problem solving' Subject: Re: [AccessD] Column Positions Yes, John, They have got "screwed" again despite the fact I edited them here correctly before I've posted this code second time. Strange. I'm leaving them like that... -- Shamil -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of JWColby Sent: Friday, March 30, 2007 9:58 PM To: 'Access Developers discussion and problem solving' Subject: Re: [AccessD] Column Positions Shamil, I straightened out the wrapping issue already. All of your DIM statements are getting pulled up to the first line for some reason. John W. Colby Colby Consulting www.ColbyConsulting.com -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Shamil Salakhetdinov Sent: Friday, March 30, 2007 1:50 PM To: 'Access Developers discussion and problem solving' Subject: Re: [AccessD] Column Positions Yes, John, it works but it may need some more tuning/polishing. Several code lines were improperly concatenated and wrapped - here is (hopefully) properly formatted sample code version: Public Sub ResetToQBEFieldsOrder(ByVal queryName As String) Dim app As Access.Application Dim dbs As DAO.Database Dim fld As DAO.Field Dim qdf As DAO.QueryDef Dim index As Integer Dim frm As Access.Form Dim ctl As Access.Control Set app = Access.Application Set dbs = app.CurrentDb Set qdf = dbs.QueryDefs(queryName) app.DoCmd.OpenQuery queryName, acViewNormal Set frm = app.Screen.ActiveDatasheet.Form index = 1 For Each fld In qdf.Fields Set ctl = frm.Controls(fld.Name) ctl.ColumnOrder = index index = index + 1 Next fld app.DoCmd.Close acQuery, queryName, acSaveYes Set qdf = Nothing Set dbs = Nothing Set app = Nothing End Sub Enjoy! -- Shamil -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of JWColby Sent: Friday, March 30, 2007 9:26 PM To: 'Access Developers discussion and problem solving' Subject: Re: [AccessD] Column Positions Cool! I will test it and if it works, throw it in my framework for the future. Thanks. John W. Colby Colby Consulting www.ColbyConsulting.com <<< tail skipped >> -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com