Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to check if record is being deleted in OnCurrent event 1

Status
Not open for further replies.

ksbigfoot

Programmer
Apr 15, 2002
856
CA
I am using MS Access 2000.
In my OnCurrent event of subform1, I call a module that refreshes subform2.
I am running into an error when I delete the record in subform1, the OnCurrent event gets called before the Form_BeforeDelConfirm event.
I don't want to call the module that refreshes subform2 when the record is being deleted in subform1.

How do I check in my OnCurrent event if the record is being deleted?

Thanks
 
I found my answer. The OnDelete event gets called before the OnCurrent event. So I set a value in a hidden textbox on the OnDelete event. In my OnCurrent event, the code runs if there is no value in that hidden textbox.

thanks
 
How are ya ksbigfoot . . .

I started to answer the same, but got stuck on the ops of the [blue]On Delete[/blue] event.

Ya see . . . when [blue]On Delete[/blue] triggers the record is removed and stored in a buffer (its not deleted yet!). This is a precursor to restoring the record in [blue]BeforeDelConfirm[/blue], in response to canceling the deletion via the delete confirm messagebox that pops up. When this occurs, another [blue]On Current[blue] event is triggered!

My point is, [blue]On Delete[/blue] is giving you a false trigger, as [purple]your refreshing before the record is actually deleted[/purple] from the table . . .

You may want to test the above . . .

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 
Howdy TheAceMan1,
Things are going great for me. Hope the same for you.
Thanks for the post. I gave you a star for your excellent post.
Thanks again,
ksbigfoot
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top