[AccessD] Saving subform format

Bill Benson bensonforums at gmail.com
Wed Jun 11 13:46:46 CDT 2014


Tom, this can be handled fairly easily.

On the command button click event, store these in an array for all controls
on the sub for of class access textbox.

ColumnOrder
ColumnWidth
ColumnHidden

Swap the sourceobject.

Then DoCmd.Echo False

Next, open the data sheet subform standalone, in data sheet view.

Loop it's controls, setting the properties according to what you stored in
the array.

Save and close, then

Docmd.Echo True

Seems easy enough in my head, I of course have not yet tried it....
 On Jun 10, 2014 10:42 AM, <ewaldt at gdls.com> wrote:

> I have a form (frmTreeView), that includes a subform. The subform has two
> possible source objects, each being a form within the application
> (sfrmTable1, and sfrmData); these are switched by the user via a command
> button.
>
> sfrmTable1 is a simple datasheet view of a query. If sfrmTable1 is the
> current source object for the subform, the user can move columns around,
> make the visible or invisible, size them, etc. If the user then closes the
> parent form (with sfrmTable1 still showing), a pop-up asks if he/she wants
> to save the format of sfrmTable1. If the user responds in the affirmative,
> sfrmTable1 is saved as it was reformatted, and it will appear that way
> next time.
>
> If, however, the user does not close the form but uses the command button
> to switch the subform's source object to sfrmData, then the formatting is
> lost. When the parent form is closed, the pop-up will again be displayed,
> but it's meaningless; the formatting has already been lost, and the user
> will only be saving the form in the format it already had.
>
> OK, sorry - long intro. What I want to happen is simply that the user's
> changes are saved automatically, without his/her ever being asked. No
> pop-ups, and no lost formatting. Is there a way to do this? I've tried
> saving sfrmTable1 (have to open it separately, and it does not reflect the
> new formatting anyway), using SendKeys (because ctrl+S works sometimes;
> doesn't seem to be consistent, though). Any other ideas? If there's some
> code to use, I could simply place it in the code behind the command button
>
> Thanks for reading this lengthy cry for help, and thanks in advance for
> any help you can give me.
>
> Tom Ewald
> Mass Properties
> General Dynamics Land Systems
> --
> 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