[AccessD] Datasheet Subform column width a unhappily resetting

jwcolby jwcolby at colbyconsulting.com
Wed Jun 8 12:37:35 CDT 2011


There is no way to programmatically change the widths as the form opens?

John W. Colby
www.ColbyConsulting.com

On 6/8/2011 9:53 AM, William Benson (VBACreations.Com) wrote:
> Hi Lambert,
>
> It was very appropriate to paste that link and in fact it is the article
> which I used to finally put in code which helped me force the columnwidths
> to be what I want them to be. That said, it does not explain how, even
> without the use of code, my form was quite acceptably retaining the
> columnwidths when he form was closed, without any need to run VBA to reset
> the widths -- up until the time when I cut the controls off the form and
> pasted them back.
>
> Anyway, since I am using the code to set columnwidths upon startup now, it
> doesn't really matter. With the exception that if you were a user, I am sure
> you would not like changing the column widths on a 15-column subform every
> single time you open the main form. I should think that it would be Access's
> default behavior to leave such settings alone - especially as the form was
> saved.
>
> *UNLESS* clicking the SAVE button on the toolbar affects the main form and
> does not have any impact on the relationship of the formatting of the
> subforms whilst they are engaged/displayed by the main form? Perhaps there
> is another way to save the settings during the session? I.e, though it is
> the long way around, I *could* read the columnwidths within the columns of
> each subform as the main form closes (or as those subforms close) and store
> them in a table then on startup of the main form, read the last used column
> widths from that table!
>
>
> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Heenan, Lambert
> Sent: Wednesday, June 08, 2011 8:54 AM
> To: Access Developers discussion and problem solving
> Subject: Re: [AccessD] Datasheet Subform column width a unhappily resetting
>
> This link might be the answer to your needs...
>
> http://msdn.microsoft.com/en-us/library/aa217449(v=office.11).aspx
>
> Lambert
>
> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of William Benson
> (VBACreations.Com)
> Sent: Monday, June 06, 2011 9:56 PM
> To: 'Access Developers discussion and problem solving'
> Subject: Re: [AccessD] Datasheet Subform column width a unhappily resetting
>
> As additional input... I have decided just to autofit the columns in code
> setting columnwidth = -2 ... but if someone knows how come, without that
> trick, my columnwidths had been set to some standard uniform width just by
> cutting and pasting the controls on the subform... I would appreciate still
> to know what I did or failed to do.
>
> -----Original Message-----
> From: William Benson (VBACreations.Com) [mailto:vbacreations at gmail.com]
> Sent: Monday, June 06, 2011 9:24 PM
> To: Access Developers discussion and problem solving
> Subject: Datasheet Subform column width a unhappily resetting
>
> Kind Sirs/Madams
>
> I had a database working pretty well, datasheet subforms on a main form. I
> had expanded their widths manually, and was happy with everything. I would
> shut the form, re-open it, the widths would stay as they were set. Then I
> decided to add another field in between the first and second fields on the
> subform. This was a little tricky to do because even though I inserted the
> field in the correct location in terms of form view, when the form opens in
> datasheet view, the field is tacked on at the end. I have in the past
> guessed maybe the datasheet view wants to show controls (i.e., columns) in
> the order in which they had been added to the form. So what I do to work
> around this is I cut all the controls out of that subform in design view and
> paste them on a different form's canvas, then cut them and paste them in the
> order I want the columns to show in datasheet view. That seems crazy but it
> works, because the controls get added to that form's controls collection
> anew, and in the r!
>   ight order.
>
> OK, well all of a sudden I do this craziness, and I get partially the result
> I want when the main form opens -- in that the datasheet subform does have
> the new field and it is in the correct position. BUT ... no matter how many
> times I stretch the columns, even SAVING the form before closing it, the
> NEXT time I open it, the columns are all the same width. Any ideas why my
> columnwidth settings are not being retained? I personally don't know if it
> has anything to do with the way the controls were added to the form -- and
> in fact I am now on my umpteenth such activity with the same form(s), and
> the problem of the columnwidths never showed up until now. But something
> changed since I added that field...
>
>
>
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>



More information about the AccessD mailing list