# Calculating Extended Price

serviceenvoy@gmail.com
Guest
Posts: n/a

 20th Apr 2007
I think what I need to do is very simple but everything I've read
online just confuses me.
Fields: Quantity, Cost, Total
All fields are on the same form
I need to create an expression that will calculate the extended price
by multiplying "QUANTITY" by "COST" and displaying the results in the
"TOTAL" field. How do I do this?

Al Campagna
Guest
Posts: n/a

 20th Apr 2007
service,
Add an unbound calculated text control to the form with a controlsource of...
= Quantity * Cost
That will always "display" the correct Total, and will recalculate whenever Quantity or
Cost is changed.

--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."

<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>I think what I need to do is very simple but everything I've read
> online just confuses me.
> Fields: Quantity, Cost, Total
> All fields are on the same form
> I need to create an expression that will calculate the extended price
> by multiplying "QUANTITY" by "COST" and displaying the results in the
> "TOTAL" field. How do I do this?
>

Carl Rapson
Guest
Posts: n/a

 20th Apr 2007
<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>I think what I need to do is very simple but everything I've read
> online just confuses me.
> Fields: Quantity, Cost, Total
> All fields are on the same form
> I need to create an expression that will calculate the extended price
> by multiplying "QUANTITY" by "COST" and displaying the results in the
> "TOTAL" field. How do I do this?
>

In the AfterUpdate events of both the Quantity and Cost controls, do your
calculation. You may need to use the Nz function in case one or the other
hasn't been entered yet. Something like:

Public Sub Quantity_AfterUpdate()
Total = Nz(Quantity,0) * Nz(Cost, 0)
End Sub

Public Sub Cost_AfterUpdate()
Total = Nz(Quantity,0) * Nz(Cost, 0)
End Sub

Of course, this doesn't contain any error checking (were valid numbers
entered for Quantity and Cost?). And, if all three controls (Quantity, Cost,
Total) are bound to fields in a table or query, you might want tore-think
your design. Since the Total can be calculated at any time from the Quantity
and Cost, there's no need to store it in the database.

Carl Rapson

serviceenvoy@gmail.com
Guest
Posts: n/a

 20th Apr 2007
On Apr 20, 5:01 pm, "Carl Rapson" <mr.mxyzp...@newsgroups.nospam>
wrote:
> <serviceen...@gmail.com> wrote in message
>
> news:(E-Mail Removed)...
>
> >I think what I need to do is very simple but everything I've read
> > online just confuses me.
> > Fields: Quantity, Cost, Total
> > All fields are on the same form
> > I need to create an expression that will calculate the extended price
> > by multiplying "QUANTITY" by "COST" and displaying the results in the
> > "TOTAL" field. How do I do this?

>
> In the AfterUpdate events of both the Quantity and Cost controls, do your
> calculation. You may need to use the Nz function in case one or the other
> hasn't been entered yet. Something like:
>
> Public Sub Quantity_AfterUpdate()
> Total = Nz(Quantity,0) * Nz(Cost, 0)
> End Sub
>
> Public Sub Cost_AfterUpdate()
> Total = Nz(Quantity,0) * Nz(Cost, 0)
> End Sub
>
> Of course, this doesn't contain any error checking (were valid numbers
> entered for Quantity and Cost?). And, if all three controls (Quantity, Cost,
> Total) are bound to fields in a table or query, you might want tore-think
> your design. Since the Total can be calculated at any time from the Quantity
> and Cost, there's no need to store it in the database.
>
> Carl Rapson

THANKS TO BOTH OF YOU.

Now, how do I make the results look like currency? i.e. \$12.00

Al Campagna
Guest
Posts: n/a

 21st Apr 2007
service,
= Format(([Quantity] * [Cost]), "\$ #.00")

--
hth
Al Campagna . Candia Computer Consulting . Candia, NH USA
Microsoft Access MVP
http://home.comcast.net/~cccsolutions

"Find a job that you love, and you'll never work a day in your life."

<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> On Apr 20, 5:01 pm, "Carl Rapson" <mr.mxyzp...@newsgroups.nospam>
> wrote:
>> <serviceen...@gmail.com> wrote in message
>>
>> news:(E-Mail Removed)...
>>
>> >I think what I need to do is very simple but everything I've read
>> > online just confuses me.
>> > Fields: Quantity, Cost, Total
>> > All fields are on the same form
>> > I need to create an expression that will calculate the extended price
>> > by multiplying "QUANTITY" by "COST" and displaying the results in the
>> > "TOTAL" field. How do I do this?

>>
>> In the AfterUpdate events of both the Quantity and Cost controls, do your
>> calculation. You may need to use the Nz function in case one or the other
>> hasn't been entered yet. Something like:
>>
>> Public Sub Quantity_AfterUpdate()
>> Total = Nz(Quantity,0) * Nz(Cost, 0)
>> End Sub
>>
>> Public Sub Cost_AfterUpdate()
>> Total = Nz(Quantity,0) * Nz(Cost, 0)
>> End Sub
>>
>> Of course, this doesn't contain any error checking (were valid numbers
>> entered for Quantity and Cost?). And, if all three controls (Quantity, Cost,
>> Total) are bound to fields in a table or query, you might want tore-think
>> your design. Since the Total can be calculated at any time from the Quantity
>> and Cost, there's no need to store it in the database.
>>
>> Carl Rapson

>
> THANKS TO BOTH OF YOU.
>
> Now, how do I make the results look like currency? i.e. \$12.00
>

serviceenvoy@gmail.com
Guest
Posts: n/a

 21st Apr 2007
On Apr 20, 11:06 pm, "Al Campagna" <alcampagna@msnewsgroups> wrote:
> service,
> = Format(([Quantity] * [Cost]), "\$ #.00")
>
> --
> hth
> Al Campagna . Candia Computer Consulting . Candia, NH USA
> Microsoft Access MVPhttp://home.comcast.net/~cccsolutions
>
> "Find a job that you love, and you'll never work a day in your life."
>
> <serviceen...@gmail.com> wrote in message
>
> news:(E-Mail Removed)...
>
> > On Apr 20, 5:01 pm, "Carl Rapson" <mr.mxyzp...@newsgroups.nospam>
> > wrote:
> >> <serviceen...@gmail.com> wrote in message

>
> >>news:(E-Mail Removed)...

>
> >> >I think what I need to do is very simple but everything I've read
> >> > online just confuses me.
> >> > Fields: Quantity, Cost, Total
> >> > All fields are on the same form
> >> > I need to create an expression that will calculate the extended price
> >> > by multiplying "QUANTITY" by "COST" and displaying the results in the
> >> > "TOTAL" field. How do I do this?

>
> >> In the AfterUpdate events of both the Quantity and Cost controls, do your
> >> calculation. You may need to use the Nz function in case one or the other
> >> hasn't been entered yet. Something like:

>
> >> Public Sub Quantity_AfterUpdate()
> >> Total = Nz(Quantity,0) * Nz(Cost, 0)
> >> End Sub

>
> >> Public Sub Cost_AfterUpdate()
> >> Total = Nz(Quantity,0) * Nz(Cost, 0)
> >> End Sub

>
> >> Of course, this doesn't contain any error checking (were valid numbers
> >> entered for Quantity and Cost?). And, if all three controls (Quantity, Cost,
> >> Total) are bound to fields in a table or query, you might want tore-think
> >> your design. Since the Total can be calculated at any time from the Quantity
> >> and Cost, there's no need to store it in the database.

>
> >> Carl Rapson

>
> > THANKS TO BOTH OF YOU.

>
> > Now, how do I make the results look like currency? i.e. \$12.00

Perfect. You guys are incredible. You don't know how much you've
helped me with these simple things.

Marryam Murtaza
Guest
Posts: n/a

 28th Sep 2009
hello

serviceenvo wrote:

Calculating Extended Price
20-Apr-07

I think what I need to do is very simple but everything I've rea
online just confuses me
Fields: Quantity, Cost, Tota
All fields are on the same for
I need to create an expression that will calculate the extended pric
by multiplying "QUANTITY" by "COST" and displaying the results in th
"TOTAL" field. How do I do this?

EggHeadCafe - Software Developer Portal of Choice
WPF DataGrid Custom Paging and Sorting

Gina Whipp
Guest
Posts: n/a

 28th Sep 2009
Marryam ,

To DISPLAY the total... in the Total field put...
+Nz([Quantity],0)*Nz([Cost],0)

Should you want to store that value you would need to put the above in the
After_Update event procedure of the Quantity field and the Cost field.

Also note, if those are not the sam names as your fields, adjust
accordingly.

--
Gina Whipp

"I feel I have been denied critical, need to know, information!" - Tremors
II

http://www.regina-whipp.com/index_files/TipList.htm

<Marryam Murtaza> wrote in message news:(E-Mail Removed)...
> hello
>
>
>
> serviceenvo wrote:
>
> Calculating Extended Price
> 20-Apr-07
>
> I think what I need to do is very simple but everything I've read
> online just confuses me.
> Fields: Quantity, Cost, Total
> All fields are on the same form
> I need to create an expression that will calculate the extended price
> by multiplying "QUANTITY" by "COST" and displaying the results in the
> "TOTAL" field. How do I do this?
>
> EggHeadCafe - Software Developer Portal of Choice
> WPF DataGrid Custom Paging and Sorting

 Thread Tools Rate This Thread Rate This Thread: 5 : Excellent 4 : Good 3 : Average 2 : Bad 1 : Terrible

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is OffTrackbacks are On Pingbacks are On Refbacks are Off Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post mthornblad@gmail.com Microsoft Access Forms 2 15th Mar 2007 07:30 AM =?Utf-8?B?QWx5c3Nh?= Microsoft Access Queries 1 12th Apr 2006 05:24 PM =?Utf-8?B?QmlsbA==?= Microsoft Access Queries 3 3rd Feb 2006 02:31 PM Jane Here Microsoft Frontpage 1 12th Dec 2004 03:36 PM Proctor Anti-Virus 0 1st Oct 2003 09:46 PM

Features