peispud
asked on
Run-time sorting causing "Save changes" dialog
Hi.
Using Office 365 - Microsoft Access on Windows 10.
My database has several forms so I have a navigation pane. I am using continuous forms.
In one of my forms, the user has the option to change the form sort at run time.
By example
The problem is that when the user moves to another form, Microsoft Access will produce a popup with the following "Do you want to save changes to the design ....."
I would like the sort option to be available, but I would prefer that this not be seen as a design change (which causes the popup).
Using Office 365 - Microsoft Access on Windows 10.
My database has several forms so I have a navigation pane. I am using continuous forms.
In one of my forms, the user has the option to change the form sort at run time.
By example
Me.OrderBy = "[StockNum] ASC": Me.OrderByOn = True:
The problem is that when the user moves to another form, Microsoft Access will produce a popup with the following "Do you want to save changes to the design ....."
I would like the sort option to be available, but I would prefer that this not be seen as a design change (which causes the popup).
you can also try setting AllowDesignChanges to false, which you can do in code before you sort:
Alternately, you can:
me.AllowDesignChanges = false
you can also set this for the form before YOU save and distribute it. Although this option no longer shows on the property sheet, it can be set through code.Alternately, you can:
DoCmd.SetWarnings False
and then open other form and then on its open event:DoCmd.SetWarnings True
However, using AllowDesignChanges would be preferable.
ASKER
I've been trying some of the suggestions. It's not working for me.
I am reluctant to mess with the DoCmd.SetWarnings =true /false commands because this would block all warnings.
I even tried the following, but still get prompted when go from one tab to another on the navigation control.
I am reluctant to mess with the DoCmd.SetWarnings =true /false commands because this would block all warnings.
I even tried the following, but still get prompted when go from one tab to another on the navigation control.
Me.OrderBy = "[StockNum] ASC": Me.OrderByOn = True:
DoCmd.Close acForm, Me.Name, acSaveYes
Since this is a Navigation control, there are things going on behind the scenes ... is there anything the user changes besides the sorting?
ASKER
The user is given the option to see the continuous form by incrementing [stock number] or by [Record ID] which is "no sort".
For testing purposes, I put the sort command in the Form Load event. The sort works fine.
I would be ok with disabling warnings with one command between the "Off" and the "On".
I am less comfortable in using this command on a form close event.
If I rem out
If I activate that same code, and then use
For testing purposes, I put the sort command in the Form Load event. The sort works fine.
I would be ok with disabling warnings with one command between the "Off" and the "On".
I am less comfortable in using this command on a form close event.
If I rem out
Me.OrderBy = "[StockNum] ASC": Me.OrderByOn = True:
then everything is fine. If I activate that same code, and then use
DoCmd.Close acForm, Me.Name, acSaveYes
, the problem is not resolved.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Microsoft Access determines that the design of the form is changed when I do a sort. I cannot seem to neutralize this determination or save the changes at run time.
The popup happens before the form unload event and the form close event so that did not work either.
The popup happens before the form unload event and the form close event so that did not work either.
DoCmd.SetWarnings False
Me.OrderBy = "[StockNum] ASC": Me.OrderByOn = True: lblSortOrder.Caption = "Form sort by [StockNum]."
DoCmd.Close acForm, Me.Name, acSaveYes
DoCmd.SetWarnings True
in the Unload event, the form is already closing ... perhaps
And then
~~~
if that doesn't work:
have an option on the main part of the form for the sort order and evaluate it on the form Load event.
DoCmd.SetWarnings False
And then
DoCmd.SetWarnings True
in the form Close event?~~~
if that doesn't work:
have an option on the main part of the form for the sort order and evaluate it on the form Load event.
ASKER
Thank you for your input. I believe this is a bug. See https://goo.gl/2qp4Bd
From this site though, I found a workaround.
For all Navigation Tabs in the Enter Event DoCmd.SetWarnings False
For all forms ... in the Form_Load event DoCmd.SetWarnings True
It's not my preferred solution, but it does work.
From this site though, I found a workaround.
For all Navigation Tabs in the Enter Event DoCmd.SetWarnings False
For all forms ... in the Form_Load event DoCmd.SetWarnings True
It's not my preferred solution, but it does work.
you're welcome ~ happy to help
glad you got something that works .... be sure to also put DoCmd.SetWarnings True in the Close event of your navigation form! ... and in the Open event of any forms or reports you popup or open
Personally, I don't usually use the Navigation control much because it does not work with complex forms, so I still use the tab control and do my own loading and unloading ... but the navigation control does handle that automatically so better use of resources.
warm regards,
crystal
~ have an awesome day ~
glad you got something that works .... be sure to also put DoCmd.SetWarnings True in the Close event of your navigation form! ... and in the Open event of any forms or reports you popup or open
Personally, I don't usually use the Navigation control much because it does not work with complex forms, so I still use the tab control and do my own loading and unloading ... but the navigation control does handle that automatically so better use of resources.
warm regards,
crystal
~ have an awesome day ~
ASKER
I will consider what you said about not using the Navigation Control. It does make things more simple, but it requires the project to be more simple as well. I am committed on this project, but I will explore in the future.
Thank you for your help. Have a great day.
Thank you for your help. Have a great day.
you're welcome ~ happy to help
warm regards,
crystal
~ have an awesome day ~
warm regards,
crystal
~ have an awesome day ~
'close and don't save
DoCmd.Close acForm, Me.Name, acSaveNo
'close and save
DoCmd.Close acForm, Me.Name, acSaveYes