DoCmd.OpenQuery or DLookup?

P

peashoe

I need a txtTotal textbox to sum all the prices in the table attendees
for a certain school
I created a query:

SELECT Sum(Attendees.[Room Price]) AS SumOfRoomPrice
FROM Attendees, Registrations
WHERE (((Registrations.[School Or
Organization])=[Forms]![Registrations]![School Or Organization]));

Any ideas how I do this?
i tried txtTotal.Value = DoCmd.OpenQuery "Attendee_Price"

OR

How does DLookup work? I tried doing that in the Control Source of the
textbox but it was giving me all the prices, not just the prices for
[School Or Organization]

and I need to make sure that when the user clicks the next record, it
only shows the price for that record (School or Organization)


Thanks in advance
Lisa
 
V

Vinayak N

Hi,

I guess you should use the DSum function:

The DSum function is mostly used in forms/reports to dynamically
sum/aggregate the values.

The syntax of the same would be found in the help of Access...

Regards,
Vinayak
 

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

Similar Threads


Top