OnClose Event Macro Action error (1 Viewer)

Sarah.M

Member
Local time
Today, 11:21
Joined
Oct 28, 2021
Messages
335
Hi, Plz note, My VBA is blocked by IT for security reason (Cybersecurity).
I can use only Expression builder, Macros, Queries, Tables, Forms and Reports only.
----------------------------------------------------------------------------
If the user want to close the frmPhone Form
if he click Yes, (Save and Requery the frmUsers Form)
If he Click No, (if the form is empty, do nothing just close frmPhone form), but if there is some data written he show Clear the data and do no save it and do not requery the main form, I try the following way but I got this error attached in the picture below
plz help me :cautious: o_O 🙏
Sample Attached
1658948211928.png

1658948154570.png
 

Attachments

  • Save If.accdb
    828 KB · Views: 102

pbaldy

Wino Moderator
Staff member
Local time
Today, 01:21
Joined
Aug 30, 2003
Messages
36,118
I don't use macros, but try testing the Dirty property of the form. This worked in a test:

1658969207055.png
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 16:21
Joined
May 7, 2009
Messages
19,169
use OnUnload method of the form.
on the OnClose Event, all the controls are already destroyed.
 

Sarah.M

Member
Local time
Today, 11:21
Joined
Oct 28, 2021
Messages
335
use OnUnload method of the form.
on the OnClose Event, all the controls are already destroyed.
Hi, I tried but still not working, please see OnUnload Event on the attached form 🙏
 

Attachments

  • Save If.accdb
    1.2 MB · Views: 105

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 16:21
Joined
May 7, 2009
Messages
19,169
it's a kinda, very hard.
since the record will be saved before it goes to the Unload/Close event of the form.
you can't use BeforeUpdate since you need to also test if the form is closing?

there is a simple solution, add a Notice whenever you are creating New record.
 

Attachments

  • Save If.accdb
    1.2 MB · Views: 97

Sarah.M

Member
Local time
Today, 11:21
Joined
Oct 28, 2021
Messages
335
it's a kinda, very hard.
since the record will be saved before it goes to the Unload/Close event of the form.
you can't use BeforeUpdate since you need to also test if the form is closing?

I put it in BeforeUpdate still nothing happen

there is a simple solution, add a Notice whenever you are creating New record.
Can you please explain this idea to me? 🙏 ☝️
 

Attachments

  • Save If (3).accdb
    1.2 MB · Views: 98

Users who are viewing this thread

Top Bottom