Newby Question - Pulling data from tables (1 Viewer)

asulliva

Registered User.
Local time
Today, 14:58
Joined
Jul 15, 2008
Messages
19
Hey guys,

I have a form that is set up like a spreadsheet. I didn't create this form, it has been handed off to me and I'm not exactly an Access expert by any means.

What I need to do is add a new row to the form for "totals" and pull numerical entries from a few different tables and get the sum off all cells in each of the columns.

For example,

I have column A which pulls from table A and I need to calculate the sum of column A and display it in a label or whatever on the form. Then beside it I need another label on the form displaying the sum of column B in table B. And so on and so forth.

This doesn't seem like it would be too difficult of a task for someone who knows Access, however I know very little about Access when it comes to forms. I was hoping someone could help.
 

maxmangion

AWF VIP
Local time
Today, 22:58
Joined
Feb 26, 2003
Messages
2,805
Hi,

you can do that with the DSum function

syntax is as follows:

DSum ( expression, domain, [criteria] )

expression = your fieldname
domain = your tablename/queryname

criteria is optional, depends if you want to specify any to limit your records.
 

asulliva

Registered User.
Local time
Today, 14:58
Joined
Jul 15, 2008
Messages
19
So I just make a label on the form and then put that code in the "On Load" event?
 

maxmangion

AWF VIP
Local time
Today, 22:58
Joined
Feb 26, 2003
Messages
2,805
Hi,

first of all you can't do that with a label but you need to use an unbound textbox on your forum and set it's source to the dsum function.

Having said that, if your form is based on a query you can use a calculated field in your query to add your fields.
 

khawar

AWF VIP
Local time
Tomorrow, 01:58
Joined
Oct 28, 2006
Messages
870
If you want to use it on label you can use following code on open event

me.label1.caption=DSum (expression, domain,[criteria])

Replace Label1 with your label name
 

asulliva

Registered User.
Local time
Today, 14:58
Joined
Jul 15, 2008
Messages
19
Alright I will try this out.

Thanks a bunch for the help.
 

Users who are viewing this thread

Top Bottom