13. januar 2005 - 09:43Der er
3 kommentarer og 1 løsning
Closing form by using macro, even if ctrl+F4 or close in fileMenu
Hi Guys, Danish will do just as fine. The Form f-reg is used to enter data into the main table. The problom is if the user closes the form, choosing Close from the File menu, moves to a different record, applies or removes a filter or a new ordering, presses Ctrl+F4, etc. My close macro isn't run, and this causes "half" records. So I need to make a solution that either run the macro or blanks all fields no mater how it is closed. I think VBA will do the trick but How? A msgbox that asks weather to save or cancel would be lovely.
The Query behind the form is called q-reg, in the form I have both combo (eg status) and text fields (eg activatedate) that has to bee blanked if not saved, and if saved they need to bee controled if they have a value (they are mandatory, not suposed to be blank).
Can one disable the standard DoCmd.Close, because it is my impressiion that this is the one that is executed when closeing the form, choosing Close from the File menu, moves to a different record, presses Ctrl+F4, etc. Or if I could set the DoCmd.Close to equal my close macro?
If you use the Form_Unload event, and insert the code from my previous answer, you could insert code where I have 'Cancel = True' to have Access ececuting some code, before unloading the form. The Unload event should execute even if you use DoCmd.Close.
Synes godt om
Ny brugerNybegynder
Din løsning...
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.