DSum Function

M

Mike

I want to use a DSum function to calculate a total of a field in a specific
table. Each table has a unique name.

I want this to be on a form. (multi record view).

the syntax would be something like

TotEng = (DSum("[KW]", **tablename**)

where tablename is a field that contains the name of the table that contains
all the KW entries.

see where i'm getting at?
 
M

Marshall Barton

Mike said:
I want to use a DSum function to calculate a total of a field in a specific
table. Each table has a unique name.

I want this to be on a form. (multi record view).

the syntax would be something like

TotEng = (DSum("[KW]", **tablename**)

where tablename is a field that contains the name of the table that contains
all the KW entries.


It looks like you are getting into a lot of trouble. Table
name should not be variable and your question raises a big
red flag about violations of the rules of ralational
database normalization.

To answer your specific question:
TotEng = DSum("[KW]", <name of field>)
 
M

Mike

believe me, i've heard the "your db is wrong" argument before. I found no
other viable way than having a table of data for a specific record, and then
using the tablenamefield in subsequent forms/queries/reports. all this goes
to the fact that the data being entered into the DB is done through a C
program which i have no control over, and works by making a new data table,
and a new main table record entry.

And to respond to your answer:
it didn't work. do the < and > need to be there or is it just the comma and
the actual name of the field?


Marshall Barton said:
Mike said:
I want to use a DSum function to calculate a total of a field in a specific
table. Each table has a unique name.

I want this to be on a form. (multi record view).

the syntax would be something like

TotEng = (DSum("[KW]", **tablename**)

where tablename is a field that contains the name of the table that contains
all the KW entries.


It looks like you are getting into a lot of trouble. Table
name should not be variable and your question raises a big
red flag about violations of the rules of ralational
database normalization.

To answer your specific question:
TotEng = DSum("[KW]", <name of field>)
 
M

Marshall Barton

Sorry, those were supposed to be square brackets

TotEng = DSum("[KW]", [name of field])

Even those are not needed unless the field name contains a
space or othe funky character.
--
Marsh
MVP [MS Access]

believe me, i've heard the "your db is wrong" argument before. I found no
other viable way than having a table of data for a specific record, and then
using the tablenamefield in subsequent forms/queries/reports. all this goes
to the fact that the data being entered into the DB is done through a C
program which i have no control over, and works by making a new data table,
and a new main table record entry.

And to respond to your answer:
it didn't work. do the < and > need to be there or is it just the comma and
the actual name of the field?


Marshall Barton said:
Mike said:
I want to use a DSum function to calculate a total of a field in a specific
table. Each table has a unique name.

I want this to be on a form. (multi record view).

the syntax would be something like

TotEng = (DSum("[KW]", **tablename**)

where tablename is a field that contains the name of the table that contains
all the KW entries.


It looks like you are getting into a lot of trouble. Table
name should not be variable and your question raises a big
red flag about violations of the rules of ralational
database normalization.

To answer your specific question:
TotEng = DSum("[KW]", <name of field>)
 

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

Top