Calculation field

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

Guest

I am working on designing a form .I want to be able to have a text box field
called “total†calculate the weight times qty. One field remains static
and this has the weight of product in it “wtâ€. Another is the “Qty†field and
that changes. I created another fieldâ€Total†with the following formula
=(sum([pc])*([qty]). What is happening is, when I add another record, it is
calculating all records. How do I write a formula that will only include the
current record?

Thanks for your assistance.
 
take of the sum.
Qualify your names Me.[pc], Me.[qty]

Also, try to use more meaningful names. Will you remember what they mean 6
months from now. How about the poor slob that inherits your app?
 
Thanks for replying. I truncated the field names for your benefit. They are
more intuitive than these. I have to ask, do i type in the word me. or is
that the form name i use, or what? thanks again

Klatuu said:
take of the sum.
Qualify your names Me.[pc], Me.[qty]

Also, try to use more meaningful names. Will you remember what they mean 6
months from now. How about the poor slob that inherits your app?

Bon43 said:
I am working on designing a form .I want to be able to have a text box field
called “total†calculate the weight times qty. One field remains static
and this has the weight of product in it “wtâ€. Another is the “Qty†field and
that changes. I created another fieldâ€Total†with the following formula
=(sum([pc])*([qty]). What is happening is, when I add another record, it is
calculating all records. How do I write a formula that will only include the
current record?

Thanks for your assistance.
 
Me. or Me! is used in forms and reports and is an object reference to the
current form or report. For example if the form's name is frmClient, the
code in the form's module could be
Forms!frmClient!
But is more commonly written as
Me.

Bon43 said:
Thanks for replying. I truncated the field names for your benefit. They are
more intuitive than these. I have to ask, do i type in the word me. or is
that the form name i use, or what? thanks again

Klatuu said:
take of the sum.
Qualify your names Me.[pc], Me.[qty]

Also, try to use more meaningful names. Will you remember what they mean 6
months from now. How about the poor slob that inherits your app?

Bon43 said:
I am working on designing a form .I want to be able to have a text box field
called “total†calculate the weight times qty. One field remains static
and this has the weight of product in it “wtâ€. Another is the “Qty†field and
that changes. I created another fieldâ€Total†with the following formula
=(sum([pc])*([qty]). What is happening is, when I add another record, it is
calculating all records. How do I write a formula that will only include the
current record?

Thanks for your assistance.
 
So I added this to the text box field: =(sum(me.[wt])*(me[Qty])). When I
push enter, the #name? comes up. Sorry to be a pain - i am a newbie and
perhaps this is not the way to perform this task. We had an old database that
I want to emulate - in that the operator can just enter the new qty and the
"total" field will automitically change right on the form. Then the operator
can print and he is done.

Klatuu said:
Me. or Me! is used in forms and reports and is an object reference to the
current form or report. For example if the form's name is frmClient, the
code in the form's module could be
Forms!frmClient!
But is more commonly written as
Me.

Bon43 said:
Thanks for replying. I truncated the field names for your benefit. They are
more intuitive than these. I have to ask, do i type in the word me. or is
that the form name i use, or what? thanks again

Klatuu said:
take of the sum.
Qualify your names Me.[pc], Me.[qty]

Also, try to use more meaningful names. Will you remember what they mean 6
months from now. How about the poor slob that inherits your app?

:

I am working on designing a form .I want to be able to have a text box field
called “total†calculate the weight times qty. One field remains static
and this has the weight of product in it “wtâ€. Another is the “Qty†field and
that changes. I created another fieldâ€Total†with the following formula
=(sum([pc])*([qty]). What is happening is, when I add another record, it is
calculating all records. How do I write a formula that will only include the
current record?

Thanks for your assistance.
 
Below, I stated when I push enter - I actually meant, when I go back into
form view..

Bon43 said:
So I added this to the text box field: =(sum(me.[wt])*(me[Qty])). When I
push enter, the #name? comes up. Sorry to be a pain - i am a newbie and
perhaps this is not the way to perform this task. We had an old database that
I want to emulate - in that the operator can just enter the new qty and the
"total" field will automitically change right on the form. Then the operator
can print and he is done.

Klatuu said:
Me. or Me! is used in forms and reports and is an object reference to the
current form or report. For example if the form's name is frmClient, the
code in the form's module could be
Forms!frmClient!
But is more commonly written as
Me.

Bon43 said:
Thanks for replying. I truncated the field names for your benefit. They are
more intuitive than these. I have to ask, do i type in the word me. or is
that the form name i use, or what? thanks again

:

take of the sum.
Qualify your names Me.[pc], Me.[qty]

Also, try to use more meaningful names. Will you remember what they mean 6
months from now. How about the poor slob that inherits your app?

:

I am working on designing a form .I want to be able to have a text box field
called “total†calculate the weight times qty. One field remains static
and this has the weight of product in it “wtâ€. Another is the “Qty†field and
that changes. I created another fieldâ€Total†with the following formula
=(sum([pc])*([qty]). What is happening is, when I add another record, it is
calculating all records. How do I write a formula that will only include the
current record?

Thanks for your assistance.
 
It the Total text box is not bound to a field in the record source (which
would be correct because calculated values should not be stored in tables),
then you can put the correct formula in the Control Souce property of Total.

= Me.wt * me.qty

If you are incorrectly storing this value in a table, go to confession, say
3 Hail Marys, and do it this way.

Put the following in the After Update event of both wt and qty:

Me.Total = IIf(IsNull(Me.wt) Or IsNull(Me.qty), Null, Me.wt * Me.qty)

Bon43 said:
So I added this to the text box field: =(sum(me.[wt])*(me[Qty])). When I
push enter, the #name? comes up. Sorry to be a pain - i am a newbie and
perhaps this is not the way to perform this task. We had an old database that
I want to emulate - in that the operator can just enter the new qty and the
"total" field will automitically change right on the form. Then the operator
can print and he is done.

Klatuu said:
Me. or Me! is used in forms and reports and is an object reference to the
current form or report. For example if the form's name is frmClient, the
code in the form's module could be
Forms!frmClient!
But is more commonly written as
Me.

Bon43 said:
Thanks for replying. I truncated the field names for your benefit. They are
more intuitive than these. I have to ask, do i type in the word me. or is
that the form name i use, or what? thanks again

:

take of the sum.
Qualify your names Me.[pc], Me.[qty]

Also, try to use more meaningful names. Will you remember what they mean 6
months from now. How about the poor slob that inherits your app?

:

I am working on designing a form .I want to be able to have a text box field
called “total†calculate the weight times qty. One field remains static
and this has the weight of product in it “wtâ€. Another is the “Qty†field and
that changes. I created another fieldâ€Total†with the following formula
=(sum([pc])*([qty]). What is happening is, when I add another record, it is
calculating all records. How do I write a formula that will only include the
current record?

Thanks for your assistance.
 
we are on the same wave length - no hail mary's today. Thanks for your help.
I will try it after my lunch break. You guys are a great help. Thanks again

Klatuu said:
It the Total text box is not bound to a field in the record source (which
would be correct because calculated values should not be stored in tables),
then you can put the correct formula in the Control Souce property of Total.

= Me.wt * me.qty

If you are incorrectly storing this value in a table, go to confession, say
3 Hail Marys, and do it this way.

Put the following in the After Update event of both wt and qty:

Me.Total = IIf(IsNull(Me.wt) Or IsNull(Me.qty), Null, Me.wt * Me.qty)

Bon43 said:
So I added this to the text box field: =(sum(me.[wt])*(me[Qty])). When I
push enter, the #name? comes up. Sorry to be a pain - i am a newbie and
perhaps this is not the way to perform this task. We had an old database that
I want to emulate - in that the operator can just enter the new qty and the
"total" field will automitically change right on the form. Then the operator
can print and he is done.

Klatuu said:
Me. or Me! is used in forms and reports and is an object reference to the
current form or report. For example if the form's name is frmClient, the
code in the form's module could be
Forms!frmClient!
But is more commonly written as
Me.

:

Thanks for replying. I truncated the field names for your benefit. They are
more intuitive than these. I have to ask, do i type in the word me. or is
that the form name i use, or what? thanks again

:

take of the sum.
Qualify your names Me.[pc], Me.[qty]

Also, try to use more meaningful names. Will you remember what they mean 6
months from now. How about the poor slob that inherits your app?

:

I am working on designing a form .I want to be able to have a text box field
called “total†calculate the weight times qty. One field remains static
and this has the weight of product in it “wtâ€. Another is the “Qty†field and
that changes. I created another fieldâ€Total†with the following formula
=(sum([pc])*([qty]). What is happening is, when I add another record, it is
calculating all records. How do I write a formula that will only include the
current record?

Thanks for your assistance.
 
Hello again. I think that I forgot to mention that "qty" and "wt" are in
different tables. I tried your formula and it is not working. Do I have to
preface the formula with the table or query name?


Bon43 said:
we are on the same wave length - no hail mary's today. Thanks for your help.
I will try it after my lunch break. You guys are a great help. Thanks again

Klatuu said:
It the Total text box is not bound to a field in the record source (which
would be correct because calculated values should not be stored in tables),
then you can put the correct formula in the Control Souce property of Total.

= Me.wt * me.qty

If you are incorrectly storing this value in a table, go to confession, say
3 Hail Marys, and do it this way.

Put the following in the After Update event of both wt and qty:

Me.Total = IIf(IsNull(Me.wt) Or IsNull(Me.qty), Null, Me.wt * Me.qty)

Bon43 said:
So I added this to the text box field: =(sum(me.[wt])*(me[Qty])). When I
push enter, the #name? comes up. Sorry to be a pain - i am a newbie and
perhaps this is not the way to perform this task. We had an old database that
I want to emulate - in that the operator can just enter the new qty and the
"total" field will automitically change right on the form. Then the operator
can print and he is done.

:

Me. or Me! is used in forms and reports and is an object reference to the
current form or report. For example if the form's name is frmClient, the
code in the form's module could be
Forms!frmClient!
But is more commonly written as
Me.

:

Thanks for replying. I truncated the field names for your benefit. They are
more intuitive than these. I have to ask, do i type in the word me. or is
that the form name i use, or what? thanks again

:

take of the sum.
Qualify your names Me.[pc], Me.[qty]

Also, try to use more meaningful names. Will you remember what they mean 6
months from now. How about the poor slob that inherits your app?

:

I am working on designing a form .I want to be able to have a text box field
called “total†calculate the weight times qty. One field remains static
and this has the weight of product in it “wtâ€. Another is the “Qty†field and
that changes. I created another fieldâ€Total†with the following formula
=(sum([pc])*([qty]). What is happening is, when I add another record, it is
calculating all records. How do I write a formula that will only include the
current record?

Thanks for your assistance.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top