save subform changes without prompting on close (1 Viewer)

abenitez77

Registered User.
Local time
Today, 12:46
Joined
Apr 29, 2010
Messages
141
I have a subform that I move columns around and change from bold to normal font. When I close the main form, it prompts me if I want to save the subform. I don't want it to prompt me, I just want it to save by default. How can i do this?
 

mike60smart

Registered User.
Local time
Today, 17:46
Joined
Aug 6, 2017
Messages
1,904
Hi

Why do you need to move Controls and Change Fonts ??

Rearranging Controls and changing Fonts is normally achieved in the Final Report Output and NOT on the Data Input of a Form.
 

abenitez77

Registered User.
Local time
Today, 12:46
Joined
Apr 29, 2010
Messages
141
The user moves the columns around to their liking. I changed the font of a random column to bold and then back to normal to trigger the save prompt.

Do you know how to default to saving without it prompting me to save when the form is closing when i click on the X ?
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 00:46
Joined
May 7, 2009
Messages
19,230
on the Unload Event of the Main Form:
Code:
Private Sub Form_Unload(Cancel As Integer)
    DoCmd.Save acForm, Me.Name
End Sub
 

abenitez77

Registered User.
Local time
Today, 12:46
Joined
Apr 29, 2010
Messages
141
I have a form with several subforms... It can be any subform that the user is changing the columns on. When i run this from the parent form:

DoCmd.Save acForm, sFormName

I get error #2489
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 12:46
Joined
Feb 19, 2002
Messages
43,257
Allowing the users to change forms on the fly is a bad idea, especially using this method. What happens when you distribute a new FE? All their changes are GONE!!!! They will not be happy campers. If you want to allow them to change column order or anything else and RETAIN that change (otherwise, what is the point?), then you need to make a table in the BE where you can log customizations by user by form by control and then reinstate them when the form opens up.
 

abenitez77

Registered User.
Local time
Today, 12:46
Joined
Apr 29, 2010
Messages
141
that's exactly what I have. I have a table that records the column orders and when the form opens it checks to see if the order is set and will set it to the last saved settings. But the order is set each time because any change gets recorded but does not save on the form. When the form closes, the column order gets lost.

So, does anyone know how to save the column order in the subform, so that any changes to the order of the subform gets saved and does not need to get reset each time the form opens?
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 12:46
Joined
Feb 19, 2002
Messages
43,257
Access has not saved column order and column width changes made in form view for several versions. A2007 was the version where MS apparently took developers off the street who had never seen Access before and ended up changing random features because none of the developers had any idea how Access used to work. I have complained but I am only one voice. Complain to MS.
 

Galaxiom

Super Moderator
Staff member
Local time
Tomorrow, 02:46
Joined
Jan 20, 2009
Messages
12,851
Access has not saved column order and column width changes made in form view for several versions.

ColumnOrder and ColumnWidth save for me on datatsheet forms.

A2010 on an mdb file.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 12:46
Joined
Feb 19, 2002
Messages
43,257
ColumnOrder and ColumnWidth save for me on datatsheet forms.
So it looks like A2003 was when this feature last worked. Or, perhaps it still works if you use an .mdb rather than .accdb.

The .mdb was replaced by .accdb TEN years ago. Just sayin' :)
 

Galaxiom

Super Moderator
Staff member
Local time
Tomorrow, 02:46
Joined
Jan 20, 2009
Messages
12,851
The .mdb was replaced by .accdb TEN years ago. Just sayin' :)

I know, but accdb brought nothing of any real consequence and took away the capability of digitally signing the code itself.

..... and apparently the saving of the ColumnWidth and ColumnOrder too?
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 17:46
Joined
Jul 9, 2003
Messages
16,278
Well I suspect I've missed the essence of the question, or got the wrong end of the Stick! Just to say that I've got MS Access 2013 and I can change the column width and column order in datasheet view in a subform (That is to say a form in datasheet view housed on a main form) then close the main form, reopen it and I can see the changes were stored. If I open the datasheet form standalone, (that is not as a subform on a main form) I can change the column order and widths and they are saved. The changes are also kept, and appear when I open the main form which houses this subform.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 00:46
Joined
May 7, 2009
Messages
19,230
Use the name of the main form and nit yhe name of any subform

Docmd.save acform, "mainformname"
 

abenitez77

Registered User.
Local time
Today, 12:46
Joined
Apr 29, 2010
Messages
141
Use the name of the main form and nit yhe name of any subform

Docmd.save acform, "mainformname"

This does not provide an error msg but it does not save the column changes. Thanks!

I guess there is no way of saving the column changes of a subform. Currently I am saving the changes to a table and then when form loads it is moving the columns to the saved settings. When the form closes it reverts back to what it is defaulted to. I was hoping to avoid loading the form each time unless necessary.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Tomorrow, 00:46
Joined
May 7, 2009
Messages
19,230
Here take a look at this sample
 

Attachments

  • aaDatasheetColumn.zip
    27.2 KB · Views: 49

Mark_

Longboard on the internet
Local time
Today, 09:46
Joined
Sep 12, 2017
Messages
2,111
@OP,

Is the database split and does each user have their own front end?

If yes, you will want to save the changes to a data file and restore them each time the user opens the form. This allows you to keep changes when you update the front end.

If not, how do you make sure one users changes don't affect others?
 

Users who are viewing this thread

Top Bottom