PDA

Click to See Complete Forum and Search --> : MS ACCESS "Save changes to the design of query"?


Pobo
Apr 25th, 2006, 12:31 PM
Hi

Got a real head banger case here!

I have one subform with a query as it's source object on a main form. When I open and close the main form without making any changes, Access still asks me:

"Do you want to save changes to the design of query 'qryFinalAmendments'?"

A command button on the main form is clicked and the event has the following code:

Private Sub cmdCloseAmendments_Click()
On Error GoTo Err_cmdCloseAmendments_Click

DoCmd.Close acForm, "frmAmendments", acSaveNo

DoCmd.OpenForm "Switchboard", acNormal

Exit_cmdCloseAmendments_Click:
Exit Sub


Err_cmdCloseAmendments_Click:
MsgBox Err.Description
Resume Exit_cmdCloseAmendments_Click

End Sub


The Form close event has no code. Can anyone tell me why I would be getting this message asking me if I would like to save changes that have not been made?

Is there a way that I can stop this message appearing - I have already tried using "DoCmd.SetWarnings False" but this doesn't stop the message being displayed?


Thanks

Pobo

Static
Apr 25th, 2006, 12:44 PM
is this the subform:

DoCmd.Close acForm, "frmAmendments", acSaveNo

Static
Apr 25th, 2006, 12:48 PM
no.. thats to close itself (the form with a subform in it) right??

RobDog888
Apr 25th, 2006, 01:01 PM
Try switching the order.
DoCmd.OpenForm "Switchboard", acNormal
DoCmd.Close acForm, "frmAmendments", acSaveNo

salvelinus
Apr 25th, 2006, 03:50 PM
Access is annoying in the way that it asks if you want to save things. Excel too. You can try DoCmd.SetWarnings False before code, setting back to True after the code runs. You can also set this as a general option for your install of Access in Tools > Options to work on all dbs. But there are some warnings this doesn't work for.
Gotta take girls to karate, can't elaborate right now, hope this helps.

RobDog888
Apr 25th, 2006, 04:25 PM
Note that SetWarnings and DisplayAlerts only take the default choice of the msgbox. If the default is acceptable then that should be ok.