Topics Search

Exit forms without saving

Exit forms without saving
Views: 56
Below is the code for exiting without saving. It works perfectly fine. I just want to know if I can change the MSGBOX message to something like "Are you sure you want to exit without saving?" instead of its default message - "Are you sure you want to delete this record?

and also, right now, if I click NO when I am asked if I want to delete this record, it exit the form rather than staying in the same form.
But how do I make it to STAY in the same form if I click NO.

Private Sub Command24_Click()
On Error GoTo Command24_Click_Err
On Error Resume Next
DoCmd.RunCommand acCmdUndo
DoCmd.OpenForm FormName:="fdlgSearchPatient"
If (MacroError <> 0) Then
MsgBox MacroError.Description, vbOKOnly, ""
End If
Exit Sub Command24_Click_Err:
MsgBox Error$
Resume Command24_Click_Exit
Sponsored Links:

Similar posts...


Exit without saving Subform

Exit without saving Subform Icon
I have a main form and a subform to it.
There is a command button in the main form for 'Exit without saving'. Some of the fields in the main form and subform is in required fields.

The code works perfectly fine if I have started answering some questions in the main form only but it did not work when I start to answer questions in the subform and when I try to save and exit.

It tells me that I need to answer some fields before I exit. How do I get the subform to be working?

Form not saving

Form not saving Icon
I am trying to figure out why on one of my forms when saving if the user doesn't click off of the last textbox it won't save the value they entered. this is the first time I have encountered this problem. I have made many different forms and never had this issue before.

Saving Form Control Properties

Saving Form Control Properties Icon
I'm working on some forms that have a number of unbound toggle buttons. When the button is clicked and becomes active, the caption of the toggle button changes from "" to "X".

I'd like to be able to save the changes to the form properties on exit, but it's apparently beyond me. (Although I do have one form that manages to save the changes. But I can't figure out why or what the difference is between that form and the rest!) I've even tried opening the forms in design mode.

A2003 takes long time to save forms

A2003 takes long time to save forms Icon
I'm developing an A2003 application and making changes to forms. Whenever I save a form, it takes 5-10 seconds to save it. However, this doesn't happen with my other applications, developed on the same machine, using the same version of Access.

- I have Win XP.
- I have at least 1GB of ram.
- The MDB file is on a C: drive, which uses only 25% of the space. So at least 75% of C: is free space.
- I am linked to some other tables in another application, which resides on a network, through ODBC drivers. But no forms use these tables, and why would these tables be accessed while saving a form in design mode?
- This doesn't happen to my other Access apps. Some of which also use ODBC linked tables.
- My MDB file is in My Documents and is only 1700kb in size.
- I did do Compact and Repair several times this week, but that didn't speed up saving forms.

Any ideas how to speed up saving forms

Form Permissions

Form Permissions Icon
I have a Form which displays a listing of partnerships data. When I place a macro button on the form - taking the user to the underlying main record (the macro reads [PSHIPClientCode]=[Forms]![FrmPartnershipListing]![PSHIPClientCode] ) I then cannot save it any more.

Then I have to exit the form without saving it. As I now cannot edit it (because it won't save!) I decided to delete it and use a copy of it.

I have looked through the security options, everything is set to Admin.

Basic Refresh Problem

Basic Refresh Problem Icon
I have a form that lists Orders (frmOrders). I have a button in the detail section that allows the user to open another form with some additional order details (frmOrderDetails), and they can also edit fields in that screen.

When they my Exit button on frmOrderDetails, it closes that form, and leaves you looking once again at frmOrders.

Here is my problem. A few fields appear on both forms. For instance, DeliveryDate. If someone goes into frmOrderDetails and updates the DeliveryDate field, when they click exit, I want that new DeliveryDate to be appearing on my frmOrders screen. I thought it'd be as simple as attaching the following to my Exit button:


It seems to work fine for me, but I have complaints from users who say that they still don't get a refreshed screen until they exit out and open frmOrders again. Doing a .Requery definitely works, but it also undoes any sorting or filtering the user has already done, so I'd like to skip that.

If someone can tell me how to make certain that the frmOrders form is correctly being refreshed,

Exit Application from Switchboard

Exit Application from Switchboard Icon
I am using a Switchboard that contains an 'Exit Application' button. The code that the Switchboard uses for exiting the application is:
' Exit the application.

1) Case conCmdExitApplication
2) CloseCurrentDatabase
This does not actually Exit the Application as I would like. It only closes the db. I would like to close the db and exit Microsoft Access completely.

Not saving a field on exit

Not saving a field on exit Icon
I'm having a minor problem. in my form, I hit the "Update" button(code below) and it works fine, but if the taxes field is Null (there are no taxes) the Total does not save when I exit the form. It does, however, when there is taxes. I just don't want my users to have to hit the update button everytime they open the form as it may cause problems

Filter Without Saving the Data Used

Filter Without Saving the Data Used Icon
I have a search form that consists of text boxes and combo boxes. If I type 10001, for example, into the Document Number text box and click my search button, it searches and pulls up the records just fine; however, when I exit out of the form and check my table, 10001, has been added as a new record.

I do not want this to happen. I had written a vba code to set the form to read-only thinking that would help, but it hasn't.

Here's the code I used to make the form read-only and for it to open to a blank form:


I have a couple other forms as well, such as an add record form, an update record form, and a delete record. I made separate forms, so we could better control our documents as all are restricted with passwords, except the search record form.

Exit Switchboard

Exit Switchboard Icon
I have an Access 2010 Switchboard with an Exit Application demand. Is there any way that I can have an Exit software demand. That is, when the Exit button is selected on the Switchboard itcloses down Access 2010 totally, instead of simply closing down the database?