Overwrite a calculated control

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I search for an answer on my question without luck, so here goes.

I a form i have a control A, [Lenght1], a control B, [width1], and a control
C [Area1].
What I want this controlers do do is this:
- Calculate the area in control C when fill in values in control A and B
- or write the area direct in control C and set A and B to zero or nothing
if there are values in them
- and have the value area too be shown in the table someway.
How do I do this?

Regards
 
Hi Tom
There is no need, and you shouldn't, store the calcuated field in the table.

In the form,you can write in the control source of field C
=IIf([A] Is Null Or Is Null,0,[A]* )

To get the resault as a table, create a query based on the Table above

Select [A],, IIf([A] Is Null Or Is Null,0,[A]* ) As [C] From
[TableName]
 
Thanks for answer.
I do what you mentioned, and half of my questin is answered. The other part
is that I want to write the area directly in control C if I dont know A or B
(this happens from time to time).
Lets say i have an area 10m2, then I want too write 10 in the C controller,
and if there are any values in A or B, I want this to be set to 0 or nothing.

It maybe unsolvable or a dreamwish from me?

--
TomH


Ofer skrev:
Hi Tom
There is no need, and you shouldn't, store the calcuated field in the table.

In the form,you can write in the control source of field C
=IIf([A] Is Null Or Is Null,0,[A]* )

To get the resault as a table, create a query based on the Table above

Select [A],, IIf([A] Is Null Or Is Null,0,[A]* ) As [C] From
[TableName]

--
Please respond to the group if your question been answered or not, so other
can refer to it.
Thank you and Good luck



TomH said:
I search for an answer on my question without luck, so here goes.

I a form i have a control A, [Lenght1], a control B, [width1], and a control
C [Area1].
What I want this controlers do do is this:
- Calculate the area in control C when fill in values in control A and B
- or write the area direct in control C and set A and B to zero or nothing
if there are values in them
- and have the value area too be shown in the table someway.
How do I do this?

Regards
 
In that case bound the C field in the form to the C field in the table.
On the after update event of fields A and B write the code

If not Isnull(Me.A) and not Isnull(Me.B) and Me.A <> 0 and Me.B <> 0 then
Me.C = Me.A * Me.B
Else
Me.C = 0
End If
==================================
About the second part, if I understood you, and you want to set A and B to 0
if you enetee value in C , then on the After update event of field C, write
the code
Me.A=0
Me.B=0

--
Please respond to the group if your question been answered or not, so other
can refer to it.
Thank you and Good luck



TomH said:
Thanks for answer.
I do what you mentioned, and half of my questin is answered. The other part
is that I want to write the area directly in control C if I dont know A or B
(this happens from time to time).
Lets say i have an area 10m2, then I want too write 10 in the C controller,
and if there are any values in A or B, I want this to be set to 0 or nothing.

It maybe unsolvable or a dreamwish from me?

--
TomH


Ofer skrev:
Hi Tom
There is no need, and you shouldn't, store the calcuated field in the table.

In the form,you can write in the control source of field C
=IIf([A] Is Null Or Is Null,0,[A]* )

To get the resault as a table, create a query based on the Table above

Select [A],, IIf([A] Is Null Or Is Null,0,[A]* ) As [C] From
[TableName]

--
Please respond to the group if your question been answered or not, so other
can refer to it.
Thank you and Good luck



TomH said:
I search for an answer on my question without luck, so here goes.

I a form i have a control A, [Lenght1], a control B, [width1], and a control
C [Area1].
What I want this controlers do do is this:
- Calculate the area in control C when fill in values in control A and B
- or write the area direct in control C and set A and B to zero or nothing
if there are values in them
- and have the value area too be shown in the table someway.
How do I do this?

Regards
 
Very big thank you and thank you again.

That worked fine. Another happy user.

Regards
--
TomH


Ofer skrev:
In that case bound the C field in the form to the C field in the table.
On the after update event of fields A and B write the code

If not Isnull(Me.A) and not Isnull(Me.B) and Me.A <> 0 and Me.B <> 0 then
Me.C = Me.A * Me.B
Else
Me.C = 0
End If
==================================
About the second part, if I understood you, and you want to set A and B to 0
if you enetee value in C , then on the After update event of field C, write
the code
Me.A=0
Me.B=0

--
Please respond to the group if your question been answered or not, so other
can refer to it.
Thank you and Good luck



TomH said:
Thanks for answer.
I do what you mentioned, and half of my questin is answered. The other part
is that I want to write the area directly in control C if I dont know A or B
(this happens from time to time).
Lets say i have an area 10m2, then I want too write 10 in the C controller,
and if there are any values in A or B, I want this to be set to 0 or nothing.

It maybe unsolvable or a dreamwish from me?

--
TomH


Ofer skrev:
Hi Tom
There is no need, and you shouldn't, store the calcuated field in the table.

In the form,you can write in the control source of field C
=IIf([A] Is Null Or Is Null,0,[A]* )

To get the resault as a table, create a query based on the Table above

Select [A],, IIf([A] Is Null Or Is Null,0,[A]* ) As [C] From
[TableName]

--
Please respond to the group if your question been answered or not, so other
can refer to it.
Thank you and Good luck



:

I search for an answer on my question without luck, so here goes.

I a form i have a control A, [Lenght1], a control B, [width1], and a control
C [Area1].
What I want this controlers do do is this:
- Calculate the area in control C when fill in values in control A and B
- or write the area direct in control C and set A and B to zero or nothing
if there are values in them
- and have the value area too be shown in the table someway.
How do I do this?

Regards
 
Back
Top