PC Review


Reply
Thread Tools Rate Thread

DSum question

 
 
peashoe@yahoo.com
Guest
Posts: n/a
 
      12th Oct 2006
here is sample data in table my Attendees

Company Name Room Price(this depends on what package they picked)
Ohio Health $350
Ohio Health $450
Ohio Health $130
Americheer $300
Americheer $400

what I need is for when we are at the Ohio Health record on the
Registrations form -
the txtTotal textbox to total $930. Then when we click the next record
button (which
is Americheer) the txtTotal = $700.

I tried entering the following in the txtTotal Control source:
=DSum("[Room Price]","Attendees","[Company] =
[Forms]![Registrations]![Company]")
but it gave me a sum of all prices ($1630)

any ideas on how do get what I need?
Thanks in advance
Lisa

 
Reply With Quote
 
 
 
 
=?Utf-8?B?S0FSTCBERVdFWQ==?=
Guest
Posts: n/a
 
      13th Oct 2006
Try this ---
SELECT YourTable.[Company Name], Sum(YourTable.[Room Price]) AS [Total Price]
FROM YourTable
GROUP BY YourTable.[Company Name];


"(E-Mail Removed)" wrote:

> here is sample data in table my Attendees
>
> Company Name Room Price(this depends on what package they picked)
> Ohio Health $350
> Ohio Health $450
> Ohio Health $130
> Americheer $300
> Americheer $400
>
> what I need is for when we are at the Ohio Health record on the
> Registrations form -
> the txtTotal textbox to total $930. Then when we click the next record
> button (which
> is Americheer) the txtTotal = $700.
>
> I tried entering the following in the txtTotal Control source:
> =DSum("[Room Price]","Attendees","[Company] =
> [Forms]![Registrations]![Company]")
> but it gave me a sum of all prices ($1630)
>
> any ideas on how do get what I need?
> Thanks in advance
> Lisa
>
>

 
Reply With Quote
 
Vinayak N
Guest
Posts: n/a
 
      13th Oct 2006
Hi,

Why don't you try putting a simple text box in the footer of the form
and then just putting in the control source
=Sum([RoomPrice]).

Regards,
Vinayak

On Oct 13, 2:31 am, peas...@yahoo.com wrote:
> here is sample data in table my Attendees
>
> Company Name Room Price(this depends on what package they picked)
> Ohio Health $350
> Ohio Health $450
> Ohio Health $130
> Americheer $300
> Americheer $400
>
> what I need is for when we are at the Ohio Health record on the
> Registrations form -
> the txtTotal textbox to total $930. Then when we click the next record
> button (which
> is Americheer) the txtTotal = $700.
>
> I tried entering the following in the txtTotal Control source:
> =DSum("[Room Price]","Attendees","[Company] =
> [Forms]![Registrations]![Company]")
> but it gave me a sum of all prices ($1630)
>
> any ideas on how do get what I need?
> Thanks in advance
> Lisa


 
Reply With Quote
 
peashoe@yahoo.com
Guest
Posts: n/a
 
      13th Oct 2006
Vinayak,
The form is pulling from the Registration Table. My data is in the
Attendees table so unfortunately, that will not work

~L~


Vinayak N wrote:
> Hi,
>
> Why don't you try putting a simple text box in the footer of the form
> and then just putting in the control source
> =Sum([RoomPrice]).
>
> Regards,
> Vinayak
>


 
Reply With Quote
 
peashoe@yahoo.com
Guest
Posts: n/a
 
      13th Oct 2006
Karl,
I just tried it and got a #Name? in the textbox. One thing I forgot to
mention, the form is pulling from the Registration Table, but my data
is in the Attendees table (both have a company column) - is this why
I'm having the problem? I also assumed that you still ment for me to
put this in the Control Source of the textbox.

This is what I have:
SELECT Attendees.[Company], Sum(Attendees.[Room Price]) AS [Total
Price] FROM Attendees GROUP BY Attendees.[Company];


~L~


KARL DEWEY wrote:
> Try this ---
> SELECT YourTable.[Company Name], Sum(YourTable.[Room Price]) AS [Total Price]
> FROM YourTable
> GROUP BY YourTable.[Company Name];
>
>


 
Reply With Quote
 
Van T. Dinh
Guest
Posts: n/a
 
      13th Oct 2006
Not sure but try:

=DSum("[Room Price]","Attendees",
"[Company] = """ & [Forms]![Registrations]![Company] & """")

I assumed the [Company] Field is a Text Field and the value of the Control
[Forms]![Registrations]![Company] is also of Text DataType corresponding to
the Filed [Company].

Note that if you use ComboBox or ListBox, the value of the Control may be
entirely different from what you see on the Form. If this is the case, make
sure the BoundColumn of the Control corresponds to the Field [Company]

--
HTH
Van T. Dinh
MVP (Access)



<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> here is sample data in table my Attendees
>
> Company Name Room Price(this depends on what package they picked)
> Ohio Health $350
> Ohio Health $450
> Ohio Health $130
> Americheer $300
> Americheer $400
>
> what I need is for when we are at the Ohio Health record on the
> Registrations form -
> the txtTotal textbox to total $930. Then when we click the next record
> button (which
> is Americheer) the txtTotal = $700.
>
> I tried entering the following in the txtTotal Control source:
> =DSum("[Room Price]","Attendees","[Company] =
> [Forms]![Registrations]![Company]")
> but it gave me a sum of all prices ($1630)
>
> any ideas on how do get what I need?
> Thanks in advance
> Lisa
>



 
Reply With Quote
 
peashoe@yahoo.com
Guest
Posts: n/a
 
      13th Oct 2006
Van,
Ok now the pop-up window appears and asks me for the Company, then the
package -and if I click "Cancel" the packages in my Attendees subform
are now gone. I'm guessing my problem is the form is pulling from
Registrations, but the info I need is from a subform Attendees, but
needs to be displayed in the Registration form. Form looks like this:

Form: Registrations (pulling from table Registrations)
Company
Address
Phone #, etc

there are several sub forms in the main form.

Sub Form: Attendees within Registration Form (pulling from Attendees
table)
Contact Name, Check-In Date, Arrival Date, Package, Extra Days,
etc...for as many people that are coming to the event

package is a drop down pulling from a package table that has the name
and the room price, when they select a package, it enters the room
price in the Attendees Table.

Then on the Registration form, there is a Finance section that has a
total of all the sub forms:
Total Deposit
Total Discounts
Total Packages (which is the one that is not working)

Total Amount Owed

nothing I try works. I keep getting a total of all the records in the
Attendees table, not just the one for the current company.

IM at a loss



Van T. Dinh wrote:
> Not sure but try:
>
> =DSum("[Room Price]","Attendees",
> "[Company] = """ & [Forms]![Registrations]![Company] & """")
>
> I assumed the [Company] Field is a Text Field and the value of the Control
> [Forms]![Registrations]![Company] is also of Text DataType corresponding to
> the Filed [Company].
>
> Note that if you use ComboBox or ListBox, the value of the Control may be
> entirely different from what you see on the Form. If this is the case, make
> sure the BoundColumn of the Control corresponds to the Field [Company]
>
> --
> HTH
> Van T. Dinh
> MVP (Access)
>


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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 Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
DSum Question DS Microsoft Access Form Coding 2 29th Sep 2008 06:48 PM
DSUM question John Microsoft Access Queries 3 11th Mar 2008 02:01 AM
DSUM question Martin Microsoft Access 4 12th Jan 2006 01:27 PM
DSUM QUESTION =?Utf-8?B?RHJldw==?= Microsoft Access 1 13th Jul 2005 05:25 PM
DSum Question =?Utf-8?B?VGhpcyBHdXk=?= Microsoft Access Forms 3 15th Feb 2005 10:11 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:36 PM.