If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Overwrite a calculated control
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 -- TomH |
#2
|
|||
|
|||
Overwrite a calculated control
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 [b] Is Null,0,[A]* [b]) To get the resault as a table, create a query based on the Table above Select [A],[b], IIf([A] Is Null Or [b] Is Null,0,[A]* [b]) 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" wrote: 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 -- TomH |
#3
|
|||
|
|||
Overwrite a calculated control
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 [b] Is Null,0,[A]* [b]) To get the resault as a table, create a query based on the Table above Select [A],[b], IIf([A] Is Null Or [b] Is Null,0,[A]* [b]) 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" wrote: 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 -- TomH |
#4
|
|||
|
|||
Overwrite a calculated control
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" wrote: 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 [b] Is Null,0,[A]* [b]) To get the resault as a table, create a query based on the Table above Select [A],[b], IIf([A] Is Null Or [b] Is Null,0,[A]* [b]) 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" wrote: 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 -- TomH |
#5
|
|||
|
|||
Overwrite a calculated control
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" wrote: 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 [b] Is Null,0,[A]* [b]) To get the resault as a table, create a query based on the Table above Select [A],[b], IIf([A] Is Null Or [b] Is Null,0,[A]* [b]) 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" wrote: 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 -- TomH |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Calculated control in subform footer area | jmvc | Setting Up & Running Reports | 0 | July 1st, 2005 08:21 AM |
rounding is ignored in calculated control | Office User | Setting Up & Running Reports | 4 | June 20th, 2005 10:25 PM |
Summing a calculated control in a report | Tony Williams | Setting Up & Running Reports | 6 | February 18th, 2005 03:19 PM |
Data Entry Mode | bdehning | Using Forms | 17 | November 22nd, 2004 04:49 PM |
How to assign value to a report control? | Peter | General Discussion | 3 | June 29th, 2004 11:17 AM |