About Control Source in Text box

J

Jeletski

Hello. I have such an easy I think problem, but do not know how to solve it.
I am creating a little programm in MS Access 2003 and in FORMS I have such
problem. In Countrol Source of TextBox, how can I put that it was sum of two
values in another TextBoxes in the same form and at the same time, it was
written the source of table where the value should be pasted. For the sum I
use "=[x]+[y]" and for the connection with table I use
"=[table_column_name]". Is it possible to connect this two each other? Thank
you.
 
K

kingston via AccessMonster.com

When do you want this to happen and can this be attached to an event? If the
two other text boxes are filled in by the user, you can use the AfterUpdate
event to set the sum field. Set the Control Source of the sum field control
to [table_column_name] and then for both of the other two text boxes have
something like:

Private Sub Text1_AfterUpdate()

If IsNull(Me.Text2)=False Then
Me.SumField = Me.Text1 + Me.Text2
End If

End Sub

You can add more error-checking to the code or use the control validation
properties to ensure good results.
Hello. I have such an easy I think problem, but do not know how to solve it.
I am creating a little programm in MS Access 2003 and in FORMS I have such
problem. In Countrol Source of TextBox, how can I put that it was sum of two
values in another TextBoxes in the same form and at the same time, it was
written the source of table where the value should be pasted. For the sum I
use "=[x]+[y]" and for the connection with table I use
"=[table_column_name]". Is it possible to connect this two each other? Thank
you.
 
P

pietlinden

Jeletski said:
Hello. I have such an easy I think problem, but do not know how to solve it.
I am creating a little programm in MS Access 2003 and in FORMS I have such
problem. In Countrol Source of TextBox, how can I put that it was sum of two
values in another TextBoxes in the same form and at the same time, it was
written the source of table where the value should be pasted. For the sum I
use "=[x]+[y]" and for the connection with table I use
"=[table_column_name]". Is it possible to connect this two each other? Thank
you.

Bad design. use a query to calculate the results. Don't store them at
all.
 
Top