Form continually Saving. Can't stop Saving Data


I am attaching a copy of the form inside the DB so we can see it.

I can't stop this form from Saving the data even if I cancel the record on the form.  Can't figure out why?

this has been driving me batty for the last few days.

I hope someone can tell me what I did wrong....

frmLogin:  18 = 1
Password: 123

part of the BackgroundLog Form

BackgroundLog should startup.
Ernest GroggAsked:
Who is Participating?
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
I'm guessing it's because there's a subform. Access will save the data on the main form when you move to the subform, and will save data on the subform when you move off the subform.

You can use the Form's BeforeUpdate event to stop the save. To do that, add a variable in the General Declarations section of the form (name it fSave, a Boolean variable), then do this in the BeforeUpdate event:

If Not fSave Then
  Cancel = True
End If

In the form's Current event, be sure to reset that value:

fSave = False

Now in your Save button, set the value to true:

fSave = True

When the acCmdSaveRecord call runs, the Form's BeforeUpdate event will run. Unless the user has clicked the "Save" button, they'll not be able to exit the subform unless they cancel their changes via the Esc key.
I suspect VBA code is used? (Currently blocked by password, hence, can't really tell what's going on).
Gustav BrockCIOCommented:
You probably save the record somewhere after entering data or entering/exiting a control.
Can't tell, as the code is password protected.

Ernest GroggAuthor Commented:
Sorry forgot to remove that....
Ernest GroggAuthor Commented:
Seems to work great!  Thanks so much!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.