473,800 Members | 2,725 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to catch events between subforms

52 New Member
I want to catch events between subforms whenever I changed data on the first form and click on the second form.

I'm on the main form. The main form consists of two subforms. I want to catch the editing of records on both. Let's say I changed data on the first subform and then I went to the next subform. I used LostFocus, DeActivate, Exit events but its not cathing the procedure for confirming the update. Only the AfterUpdate event catches them all. The problem is I have to do it two times to get out of the loop to go to the next subform.

On the first subform, there is a form's BeforeUpdate on all controls that if it is not equal to the OldValue property it will change a variable to true.

Dim C As Control
For Each C In Me.Controls
Select Case C.ControlType
Case acTextBox, acComboBox, acListBox, acOptionGroup, acCheckBox
If C.Value <> C.OldValue Then
UpdateDone = True
End If
End Select
Next C

And now I'm trying to catch that by placing this code on the this subform's LostFocus and DeActivate but only works on AfterUpdate event and it prompts again after I select "No"

If ChangedData = True Then
ChangedData = False

Dim ans As Integer
ans = MsgBox("A record has been changed." & vbCrLf & vbCrLf & _
"Do you want to save it?", vbYesNo + vbQuestion, "Changed Records.")
If ans = vbYes Then

Me.Parent.txtAb out_UpdatedBy = fOSUserName
Else
DoCmd.DoMenuIte m acFormBar, acEditMenu, acUndo, , acMenuVer70
End If
End If
Sep 13 '06 #1
2 2282
PEB
1,418 Recognized Expert Top Contributor
Hi,
Why do not try to add this code to each subform before update event?

And not for the totality of the form!

If it is for the totality you can't undo when there is multi records in the subform!

Have a nice day!
:)
Sep 13 '06 #2
PEB
1,418 Recognized Expert Top Contributor
gazelle04 Thank you!

Your thread about tracking changes and making undo of records was very usefull for me! :)

In fact i've seen for the first time the use of oldvalue property in before update event!

And I've used today! It does amazing job! And opens a lot my hands to do what I want! :)

Thank you!

:)

Vladimir
Sep 14 '06 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
1464
by: Olivier | last post by:
Hi, I have a (newbie)problem with a macro activated in a subform. That's the hierarchy in my form: Main form ----subform1 ----subform2 ----subform3 I have a macro that is called on OnActivate in subform1 and that macro
0
2245
by: Jack | last post by:
Gday everyone, I'm dearly hoping Stephen Lebans is going to update his masterpeice to stop the mouse wheel scrolling to work on subforms *he has indicated this to me but of course beggers can't be choosers here so I have no idea when this would be done*. I'm just wondering if anyone has gotten around the problem some other way? --Original Thread---
1
3734
by: xmp333 | last post by:
Hi, I have a form that is designed as a data sheet view. Attached to this is a subform with some VB code. When the user clicks on a row, the subform should pop up and run the VB code which accesses the record corresponding to the row clicked. To get this row, I tried using Me.Parent.Bookmark. Unfortunately, this gets the "Current Record" which is set via the navigation
1
2374
by: deko | last post by:
I have a popup "Tools" form with a tab control that has a different subform on each tab. The problem is that new tabs/subforms continue to be added as users request new features - so the code on each subform's Form_Open/Load/Current event fires whenever the popup form is opened, making the popup form slow to open and causing problems when a function in one subform is dependent on data or events in another subform (on a different tab). ...
5
3405
by: Simon Tamman {Uchiha Jax} | last post by:
Now this is bugging me. I just released software for a client and they have reported an unhandled stack overflow exception. My first concern is that the entirity of the UI and any threaded operations are all within Try Catches to help me locate the problem and the origination of any problem by specifiying an error code in the "Catch" section. So theoretically this shouldn't have been possible (at which point we all say "yeah,...
5
1832
by: sleepinglord | last post by:
An example: I have a select input. I wanna catch those onclick events which is not a onchange events. How to implement it? And in general, there's some basic kinds of events, and I wanna catch the events which is a composition of the basic events. How to? Where can I find some examples£¿
4
6060
by: Harlequin | last post by:
I have a question concerning the need to trigger events within a "child" subform which is itself enbedded within a master "parent" form and which is accessible via a tab in the parent form. Becuase this is all very difficult to explain in words, please bear with me as I endevour to explain what it is I am trying to do. It would be helpful if I could attach a graphics file to this posting that would help explain what it is I'm trying to achieve...
11
1491
by: darrel | last post by:
Trying to get back into .net again after being out of it for a while. I'm trying to figure out the proper way to handle multiple events via a try catch. What I'm confused about is the proper method to handle, say, 3 separate events: A, B, and C. I only want all 3 to execute if all 3 can successfully execute. Is that what a try-catch is for, or is a try/catch mainly for individual
0
9690
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9551
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10504
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10274
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10033
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9085
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6811
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5469
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4149
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.