Get rid of dialog box when closing Access 2010

olaa

New member
Local time
Today, 23:53
Joined
Oct 17, 2013
Messages
9
I have a Access 2010 DB. The mainform have a subform with one table alone.
I have a button who close Access when the user are finish on the mainform. Still I have the upper right
corner X-button who also closing the app. you now.

My problem is that when the user use the X-button then a dialog box appear and ask for saving the
changes for the table in the subform on the main form… The user must then do the choise “yes” “no” “Cancel”.

There is no need for this dialog box, (I take care if it’s necessary earlier) but I can’t get rid of it. I have tried everything, probably not ;-) but allot.

Please I need help.

Thank you so much for your help.
Ola A.
 
What is the line of Code you have in the button that closes Access?
 
I writes in Swedish, but below you can see the code in VBA. :)

Why do you want to know this? This code works fine, it is when I use Access X as the problem arises.

Regard
Ola A.

---------------------------------------------------

Private Sub knp_stäng_Click()

'---Vi frågar om man ska avsluta
If MsgBox("Är ni säker att ni vill avsluta databasen?", vbQuestion + vbYesNo + vbDefaultButton2) = vbYes Then

'---Om ja stänger vi
DoCmd.Quit
End If

End Sub
 
Okay on the unload method of the Subform use..
Code:
DoCmd.Close acForm, "subFormsName", acSaveNo
 
There is a command which will turn the warnings off , DoCmd.SetWarnings False BUT it effects the whole form and has to be turned back to True to provide warnings for other problems that might occur.
I would suggest you disable the close x button and place a new command button with just Docmd.quit . without the ac promps


my solution is base on that you wish to quit the application if just the form then Pr2-eugin is the answer.
Hope this is of some use to you
 
Last edited:
It's the table in the subform in the form who givs this question, not the form it self.

How can I get rid of the close x button? I already have command button with just Docmd.quit.

Read my question...


/Ola
 
So you tried my suggestion and it still does not work?? Interesting.. :rolleyes:
 
Nop ;)

The sub form only have "Exit" and "Enter" as events.
I have tried to put the code in the "Exit" without success.
To view the message, see attached image...

/Ola A.
 

Attachments

  • close1.JPG
    close1.JPG
    17.4 KB · Views: 161
The attachment suggests that you have not created a Subform, but just dragged and dropped the table. Try creating a SubForm first and then try doing this..

If you have created a SubForm then I suggest you open the SubForm in design mode you will find the On Unload event..

If it still confuses, post a Stripped DB.
How to Upload a Stripped DB.

To create a Sample DB (to be uploaded for other users to examine); please follow the steps..

1. Create a backup of the file, before you proceed..
2. Delete all Forms/Queries/Reports that are not in Question (except the ones that are inter-related)
3. Delete auxiliary tables (that are hanging loose with no relationships).
4. If your table has 100,000 records, delete 99,990 records.
5. Replace the sensitive information like Telephone numbers/email with simple UPDATE queries.
6. Perform a 'Compact & Repair' it would have brought the Size down to measly KBs..
7. (If your Post count is less than 10 ZIP the file and) Upload it..

Finally, please include instructions of which Form/Query/Code we need to look at. The preferred Access version would be A2003-A2007 (.mdb files)
 
I'm starting to give up on this.
I have a sub form that I have linked to a table.
I have not only dragged and dropped. Still it's the table in the sub form woho trigger the message... See attached image ...

/Ola A
 

Attachments

  • skärmdump1.jpg
    skärmdump1.jpg
    38.5 KB · Views: 152
Thanks for nice comments.The therad is very informative and enhances my knowledge.
 

Users who are viewing this thread

Back
Top Bottom