473,474 Members | 1,682 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Control bound to an expression - telling when it has changed

2 New Member
Hi
I'd like to act upon an text control's content change.
the text control is bound to an expression.

The thing I want to implement is a text control which is bound to a normal field in a table, but also is filled automatically by summing some other fields on the form.

I've tried almost all events for the text control, but they all seem to be raised upon manual updating of the text, and not a calculated expression being changed.
Nov 14 '08 #1
3 1506
Stewart Ross
2,545 Recognized Expert Moderator Specialist
Hi. There are no in-built control events that will recognise value changes in calculated controls.

You will need to reconsider what underlies the value change you mention; after all, the change in value results from an event somewhere else. Where does the change to the next value occur? How do you recognise it? What fields are affected, in what tables?

It seems to me that the change to the input values feeding the calculated control is what you need to trap - not the consequences on the dependent calculated control itself.

-Stewart
Nov 14 '08 #2
missinglinq
3,532 Recognized Expert Specialist
Stewart is right, of course, you need to trap what triggers the change in your control/field, not the change to the control/field itself. Here's a very simplified example.

You have three textboxes, txtFieldA, txtFieldB and txtFieldC. Basically

txtFieldC = txtFieldA * txtFieldB

so with txtFieldC being bound to a field in your underlying query or table, in the AfterUpdate events of txtFieldA and txtFieldB:

Expand|Select|Wrap|Line Numbers
  1. Private Sub txtFieldA_AfterUpdate()
  2.  If Not IsNull(Me.txtFieldB) Then
  3.    Me.txtFieldC = Me.txtFieldA * Me.txtFieldB
  4.  End If
  5. End Sub
Expand|Select|Wrap|Line Numbers
  1. Private Sub txtFieldB_AfterUpdate()
  2. If Not IsNull(Me.txtFieldA) Then
  3.    Me.txtFieldC = Me.txtFieldA * Me.txtFieldB
  4.  End If
  5. End Sub
Now if there are values in txtFieldA and txtFieldB, txtFieldC will automatically be updated and stored when the record is saved.

Welcome to Bytes!

Linq ;0)>
Nov 14 '08 #3
avibandel
2 New Member
Hi. There are no in-built control events that will recognise value changes in calculated controls.

You will need to reconsider what underlies the value change you mention; after all, the change in value results from an event somewhere else. Where does the change to the next value occur? How do you recognise it? What fields are affected, in what tables?

It seems to me that the change to the input values feeding the calculated control is what you need to trap - not the consequences on the dependent calculated control itself.

-Stewart
well, the text control i'm talking about holds a summary of a column in a subform.
What I want to do is to save this total into a different field, on some other subform.
Nov 14 '08 #4

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

Similar topics

3
by: PAUL EDWARDS | last post by:
I have a windows form that is bound to a datatable. In VB6 I could just update the field contents and it would be updated in the database, however if I update the text property of the control from...
7
by: vindaloo1 | last post by:
I'm using Access 2000 and I have a main form and a subform. When a control on the subform is updated I am trying to update a control on the mainform. But instead of updating the control on the...
2
by: David Batt | last post by:
Hi, I need to determine when data in a datagrid bound to a dataset has changed and thus make updates accordingly. I would of thought the code below would detect when a change has been made to...
11
by: John J. Hughes II | last post by:
I have a DataGridView displaying data from a DataSet. To the right of that I have a custom user control which displays one of the data set fields. The custom user control is bound to the data set...
14
by: mchlle | last post by:
How can I filter records of a subform that is part of a tab control? The filter works fine on the form when it is not part of the tab using this in the macro condition: !!="Today" I have a main...
14
by: Rolf Welskes | last post by:
Hello, I have an ObjectDataSource which has as business-object a simple array of strings. No problem. I have an own (custom) control to which I give the DataSourceId and in the custom-control...
7
by: | last post by:
I have what's probably a simple page lifecycle question related to dynamically evaluating values that are placed by a repeater and dynmically placing user controls that use those values. I'm...
1
by: Bishop | last post by:
Any ideas on why this is happening or how I can fix it? For instance if I forget to declare a SQL Variable and assign it a value instead of telling me that it redirects to 404 page not found...
0
by: morathm | last post by:
I have a windows client database management application written in C# that connects to remote web services to do all the heavy work. The thin-client app uses strong typed datasets, all maintained at...
0
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,...
0
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...
0
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...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.