sum data from another table in my form

steve111

Registered User.
Local time
Today, 22:49
Joined
Jan 30, 2014
Messages
429
hi

I have a table called allevents and another called tblevent

the 2 forms that I use are linked by a field called eventid

the table tblevent will have say eventid 1 but the all events could have many records linked to eventid 1

in the table called allevents there is a cost field.
how can I put a text field in my form tblevents that links to the form allevents and sums all the costs from eventsid 1

thanks
steve
 
is tblevent a subform of all event form?
you can use dsum function:

=Dsum("cost field", "all events", "eventsid = " & me.eventdsid)
 
hi

no , the form "all events" is the subform

steve
 
same formula, since we are working with the table.
 
HI
I am getting a "name" error

if I put this " =DSum("cost","all events",[eventid]) I get the total in the table
if I put this the " me.eventid is when I get the error
if I put the form name and eventid I still get the error

steve
 
sorry about that, we need to enclose the table name in brackets since there are spaces on your table name:

=Dsum("cost field", "[all events]", "eventsid = " & me.eventdsid)
 
hi

still got same problem

=DSum("cost","[all events]","eventid = " & [me].[eventid])

I have changed the field name in th formular as I had got it wrong in my first post
I have attached the database for you to see
steve
 

Attachments

Last edited:
hi

this has come as a PHP file
can you please explain how to open that

thanks
steve
 
use firefox of cyberfox browser.
 
I cannot download that . in china we get very restricted sometimes

did you use another formula to make it work or did I type it wrong?

thanks
steve
 
the formula is:

=CDbl(Nz(DSum("cost","[all events]","eventid = " & [eventid]),0))
 

Users who are viewing this thread

Back
Top Bottom