Undo data entry on lost focus?

  • Thread starter BonnieW via AccessMonster.com
  • Start date
B

BonnieW via AccessMonster.com

My form has a bit of code in it where, OnActivate, it will go to a new record.
This is great for the purpose it was intended, but has the unfortunate side-
effect of pulling a new record whenever someone moves to another open object
(form, table, whatever)- so if a user is having a particularly ADHD-day, or
feels the need to compulsively "check their work," I could end up with
multiple bad records.

In an effort to user-proof this a bit, I inserted a bit of code in the
OnDeactivate event, which goes like this:
Private Sub Form_Deactivate()
If Me.Dirty Then
If CurrentProject.AllForms("frmTrailWork").IsLoaded Or
CurrentProject.AllForms("frmInvasivesControl").IsLoaded Or CurrentProject.
AllForms("frmRevegetation").IsLoaded Then
Me.Visible = False
Else: Me.Undo
End If
End If

End Sub

So, the way I'm reading that, is that if one of those forms is open, my form
(frmVolEffortGen, if you care to know) will simply become invisible, unable
to be activated again until a button turns it visible. However, if those
forms aren't loaded, and data has been entered (which it invariably will have)
, it will undo the data entry. That's not happening. Do I have the order of
events wrong? Is there a flaw in my IF statement? Is there something else
that I'm just not getting?

Thanks in advance!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top