Solved Is Any Event Triggered When Data Is Pasted Into A DataSheet SubForm (1 Viewer)

bob fitz

AWF VIP
Local time
Today, 06:15
Joined
May 23, 2011
Messages
4,729
How can I catch when a user "Pastes" several rows of data into a DataSheet Subform?
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 22:15
Joined
Oct 29, 2018
Messages
21,604
Hi. I just did a quick test. It appears all the regular events for each record fire. So, if you paste two records, the events fire twice.
 
Last edited:

bob fitz

AWF VIP
Local time
Today, 06:15
Joined
May 23, 2011
Messages
4,729
Looks like all the regular events for each record fire.
Hi theDBguy

Thanks for your interest and reply.
I placed a breakpoint on the following form events: OnDirty, AfterUpdate and AfterInsert but when I pasted several records (pasting into the top left corner of the form) none of these events fired.

The wording of your reply suggests, to me, that you found at least one that did. Could you enlighten me please.
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 22:15
Joined
Oct 29, 2018
Messages
21,604
Hi theDBguy

Thanks for your interest and reply.
I placed a breakpoint on the following form events: OnDirty, AfterUpdate and AfterInsert but when I pasted several records (pasting into the top left corner of the form) none of these events fired.

The wording of your reply suggests, to me, that you found at least one that did. Could you enlighten me please.
Hi. I didn't test all the events, but the following worked for me. Before Insert, Before Update, After Update, and After Insert.

Also, I simply used Debug.Print to let me know which events fired. Perhaps, trying to break into the code is ignored when pasting? Try using Debug.Print to see if that works in your db too.
 

bob fitz

AWF VIP
Local time
Today, 06:15
Joined
May 23, 2011
Messages
4,729
Hi. I didn't test all the events, but the following worked for me. Before Insert, Before Update, After Update, and After Insert.

Also, I simply used Debug.Print to let me know which events fired. Perhaps, trying to break into the code is ignored when pasting? Try using Debug.Print to see if that works in your db too.
Oh Dear... I fear this is another occasion when I should have left opening that bottle of Merlot until later. I'm feeling more than a little embarrassed now. You are of course quite right about all the usual events firing and I can even confirm that the code does stop when a breakpoint is place in the SUBform. I can also confirm that none of those events fire on the main form when pasting into the subform but then agian, why would they?
My apologies for wasting your time but as always I'm grateful for the interest and the help given.
 

theDBguy

I’m here to help
Staff member
Local time
Yesterday, 22:15
Joined
Oct 29, 2018
Messages
21,604
Oh Dear... I fear this is another occasion when I should have left opening that bottle of Merlot until later. I'm feeling more than a little embarrassed now. You are of course quite right about all the usual events firing and I can even confirm that the code does stop when a breakpoint is place in the SUBform. I can also confirm that none of those events fire on the main form when pasting into the subform but then agian, why would they?
My apologies for wasting your time but as always I'm grateful for the interest and the help given.
Hi Bob. Glad to hear you got it sorted out. Good luck with your project.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 01:15
Joined
Feb 19, 2002
Messages
43,700
I have senility issues also. Wine is not my go to drink. The memory of getting drunk on Bali Hi when I was 19 does remain in my memory though. I'm sure it is displacing something far more pleasant:cry:
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 00:15
Joined
Feb 28, 2001
Messages
27,463
This is a case like the old philosophical question of "does a tree falling in a forest make a noise if no one is there to hear it?"

Does an event fire even though the app has no event code to handle it?

The answer to the "app" question is yes, with the proviso that the event will limited to the place that WOULD have fielded it. So if you do something to the subform then events on the subform will fire appropriately but the main form will do nothing unless the subform's event code "reaches out and touches" the main form. Technically, it is the Access event that triggers the app's event code. Where you work is where the events occur.

The answer to the "tree" question depends on whether you ask the question using "sound" vs. "noise" since they have different connotations.

Ever since my liver went wonky on me, I'll have to demur on that wine. Enjoy my share, take a sip for me.
 

Users who are viewing this thread

Top Bottom