multiply one text box on report by a value

G

gbpg

I have a report with some calculated fields that produce a sum of values in a
query this is achieved by =-DSum("[xxxxxx]","[anotherfieldxxx]") I need to
multiply this by another value(i.e. 20.00 dollars and can't get this to work
not sure why
 
T

Tom Wickerath

achieved by =-DSum("[xxxxxx]","[anotherfieldxxx]")

Your DSum expression does not look correct to me. What does the "[xxxxxx]"
part represent. It should be the name of a field. The next part,
"[anotherfieldxxx]", should be the name of a table or query (the Domain).

All domain aggregrate functions (DSum, DMax, DMin, DLookup, etc.) share the
same common parameters:

DFunction("Expression", "Domain", "OptionalCriteria")

Here is a good article on The Access Web for your reference:

DLookup Usage Samples
http://www.mvps.org/access/general/gen0018.htm


Tom Wickerath
Microsoft Access MVP
https://mvp.support.microsoft.com/profile/Tom
http://www.access.qbuilt.com/html/expert_contributors.html
__________________________________________
 
G

gbpg

Ok I will show the expression more like the real thing:
The text box control source would be =-DSum("[one filed]","[anotherfieldxxx]")
this works it gives me a total of the staff trained in those fields (which
are boolean check boxes)

now I want to multiply this value by the hours it takes to complete the
training and then the cost of the course.


Tom Wickerath said:
achieved by =-DSum("[xxxxxx]","[anotherfieldxxx]")

Your DSum expression does not look correct to me. What does the "[xxxxxx]"
part represent. It should be the name of a field. The next part,
"[anotherfieldxxx]", should be the name of a table or query (the Domain).

All domain aggregrate functions (DSum, DMax, DMin, DLookup, etc.) share the
same common parameters:

DFunction("Expression", "Domain", "OptionalCriteria")

Here is a good article on The Access Web for your reference:

DLookup Usage Samples
http://www.mvps.org/access/general/gen0018.htm


Tom Wickerath
Microsoft Access MVP
https://mvp.support.microsoft.com/profile/Tom
http://www.access.qbuilt.com/html/expert_contributors.html
__________________________________________

gbpg said:
I have a report with some calculated fields that produce a sum of values in a
query this is achieved by =-DSum("[xxxxxx]","[anotherfieldxxx]") I need to
multiply this by another value(i.e. 20.00 dollars and can't get this to work
not sure why
 
D

Douglas J. Steele

It's likely the names you're using that's causing the confusion.

Your second argument (anotherfieldxxx) sounds like the name of a field in a
table, whereas it has to be the name of a table or query.

If that's giving you a valid numeric value, though, I see no reason why

=-DSum("[one filed]","[anotherfieldxxx]") * 20

shouldn't work.


--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


gbpg said:
Ok I will show the expression more like the real thing:
The text box control source would be =-DSum("[one
filed]","[anotherfieldxxx]")
this works it gives me a total of the staff trained in those fields (which
are boolean check boxes)

now I want to multiply this value by the hours it takes to complete the
training and then the cost of the course.


Tom Wickerath said:
achieved by =-DSum("[xxxxxx]","[anotherfieldxxx]")

Your DSum expression does not look correct to me. What does the
"[xxxxxx]"
part represent. It should be the name of a field. The next part,
"[anotherfieldxxx]", should be the name of a table or query (the Domain).

All domain aggregrate functions (DSum, DMax, DMin, DLookup, etc.) share
the
same common parameters:

DFunction("Expression", "Domain", "OptionalCriteria")

Here is a good article on The Access Web for your reference:

DLookup Usage Samples
http://www.mvps.org/access/general/gen0018.htm


Tom Wickerath
Microsoft Access MVP
https://mvp.support.microsoft.com/profile/Tom
http://www.access.qbuilt.com/html/expert_contributors.html
__________________________________________

gbpg said:
I have a report with some calculated fields that produce a sum of
values in a
query this is achieved by =-DSum("[xxxxxx]","[anotherfieldxxx]") I need
to
multiply this by another value(i.e. 20.00 dollars and can't get this to
work
not sure why
 
G

gbpg

It does work now (with currency as format) and I can multiply by the hours.

How would I add another field that is called [emp_trd_code] and select out
of this certain values for example T1 OR T2? I am not sure what the syntax is
for this despite Tom's reference to the Microsoft article.

Would this be to add in the paranthesis ("[first
field]","[secondfield]",'[emp_trd_code]=T1") I get an error.


Douglas J. Steele said:
It's likely the names you're using that's causing the confusion.

Your second argument (anotherfieldxxx) sounds like the name of a field in a
table, whereas it has to be the name of a table or query.

If that's giving you a valid numeric value, though, I see no reason why

=-DSum("[one filed]","[anotherfieldxxx]") * 20

shouldn't work.


--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


gbpg said:
Ok I will show the expression more like the real thing:
The text box control source would be =-DSum("[one
filed]","[anotherfieldxxx]")
this works it gives me a total of the staff trained in those fields (which
are boolean check boxes)

now I want to multiply this value by the hours it takes to complete the
training and then the cost of the course.


Tom Wickerath said:
achieved by =-DSum("[xxxxxx]","[anotherfieldxxx]")

Your DSum expression does not look correct to me. What does the
"[xxxxxx]"
part represent. It should be the name of a field. The next part,
"[anotherfieldxxx]", should be the name of a table or query (the Domain).

All domain aggregrate functions (DSum, DMax, DMin, DLookup, etc.) share
the
same common parameters:

DFunction("Expression", "Domain", "OptionalCriteria")

Here is a good article on The Access Web for your reference:

DLookup Usage Samples
http://www.mvps.org/access/general/gen0018.htm


Tom Wickerath
Microsoft Access MVP
https://mvp.support.microsoft.com/profile/Tom
http://www.access.qbuilt.com/html/expert_contributors.html
__________________________________________

:

I have a report with some calculated fields that produce a sum of
values in a
query this is achieved by =-DSum("[xxxxxx]","[anotherfieldxxx]") I need
to
multiply this by another value(i.e. 20.00 dollars and can't get this to
work
not sure why
 
D

Douglas J. Steele

Since you're talking about a text field (as opposed to a numeric field), you
need quotes around the value:

=("[first field]","[secondfield]",'[emp_trd_code]='T1'")

To check for two possible values, you can either use the IN operator:

=("[first field]","[secondfield]",'[emp_trd_code] IN ('T1', 'T2')")

or you repeat the condition:

=("[first field]","[secondfield]",'[emp_trd_code]='T1' OR
[emp_trd_code]='T2'")

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


gbpg said:
It does work now (with currency as format) and I can multiply by the
hours.

How would I add another field that is called [emp_trd_code] and select out
of this certain values for example T1 OR T2? I am not sure what the syntax
is
for this despite Tom's reference to the Microsoft article.

Would this be to add in the paranthesis ("[first
field]","[secondfield]",'[emp_trd_code]=T1") I get an error.


Douglas J. Steele said:
It's likely the names you're using that's causing the confusion.

Your second argument (anotherfieldxxx) sounds like the name of a field in
a
table, whereas it has to be the name of a table or query.

If that's giving you a valid numeric value, though, I see no reason why

=-DSum("[one filed]","[anotherfieldxxx]") * 20

shouldn't work.


--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


gbpg said:
Ok I will show the expression more like the real thing:
The text box control source would be =-DSum("[one
filed]","[anotherfieldxxx]")
this works it gives me a total of the staff trained in those fields
(which
are boolean check boxes)

now I want to multiply this value by the hours it takes to complete the
training and then the cost of the course.


:

achieved by =-DSum("[xxxxxx]","[anotherfieldxxx]")

Your DSum expression does not look correct to me. What does the
"[xxxxxx]"
part represent. It should be the name of a field. The next part,
"[anotherfieldxxx]", should be the name of a table or query (the
Domain).

All domain aggregrate functions (DSum, DMax, DMin, DLookup, etc.)
share
the
same common parameters:

DFunction("Expression", "Domain", "OptionalCriteria")

Here is a good article on The Access Web for your reference:

DLookup Usage Samples
http://www.mvps.org/access/general/gen0018.htm


Tom Wickerath
Microsoft Access MVP
https://mvp.support.microsoft.com/profile/Tom
http://www.access.qbuilt.com/html/expert_contributors.html
__________________________________________

:

I have a report with some calculated fields that produce a sum of
values in a
query this is achieved by =-DSum("[xxxxxx]","[anotherfieldxxx]") I
need
to
multiply this by another value(i.e. 20.00 dollars and can't get this
to
work
not sure why
 
G

gbpg

Thanks Douglas that did the trick, now I will try and multiply that text box
by the dollars for the rate.

Douglas J. Steele said:
Since you're talking about a text field (as opposed to a numeric field), you
need quotes around the value:

=("[first field]","[secondfield]",'[emp_trd_code]='T1'")

To check for two possible values, you can either use the IN operator:

=("[first field]","[secondfield]",'[emp_trd_code] IN ('T1', 'T2')")

or you repeat the condition:

=("[first field]","[secondfield]",'[emp_trd_code]='T1' OR
[emp_trd_code]='T2'")

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


gbpg said:
It does work now (with currency as format) and I can multiply by the
hours.

How would I add another field that is called [emp_trd_code] and select out
of this certain values for example T1 OR T2? I am not sure what the syntax
is
for this despite Tom's reference to the Microsoft article.

Would this be to add in the paranthesis ("[first
field]","[secondfield]",'[emp_trd_code]=T1") I get an error.


Douglas J. Steele said:
It's likely the names you're using that's causing the confusion.

Your second argument (anotherfieldxxx) sounds like the name of a field in
a
table, whereas it has to be the name of a table or query.

If that's giving you a valid numeric value, though, I see no reason why

=-DSum("[one filed]","[anotherfieldxxx]") * 20

shouldn't work.


--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Ok I will show the expression more like the real thing:
The text box control source would be =-DSum("[one
filed]","[anotherfieldxxx]")
this works it gives me a total of the staff trained in those fields
(which
are boolean check boxes)

now I want to multiply this value by the hours it takes to complete the
training and then the cost of the course.


:

achieved by =-DSum("[xxxxxx]","[anotherfieldxxx]")

Your DSum expression does not look correct to me. What does the
"[xxxxxx]"
part represent. It should be the name of a field. The next part,
"[anotherfieldxxx]", should be the name of a table or query (the
Domain).

All domain aggregrate functions (DSum, DMax, DMin, DLookup, etc.)
share
the
same common parameters:

DFunction("Expression", "Domain", "OptionalCriteria")

Here is a good article on The Access Web for your reference:

DLookup Usage Samples
http://www.mvps.org/access/general/gen0018.htm


Tom Wickerath
Microsoft Access MVP
https://mvp.support.microsoft.com/profile/Tom
http://www.access.qbuilt.com/html/expert_contributors.html
__________________________________________

:

I have a report with some calculated fields that produce a sum of
values in a
query this is achieved by =-DSum("[xxxxxx]","[anotherfieldxxx]") I
need
to
multiply this by another value(i.e. 20.00 dollars and can't get this
to
work
not sure why
 
T

Tom Wickerath

Hi gbpg,

I'm glad to see that you are making some progress, per the later posts
you've made.
...despite Tom's reference to the Microsoft article.

The reference I gave was to The Access Web, which is not run by Microsoft.


Tom Wickerath
Microsoft Access MVP
https://mvp.support.microsoft.com/profile/Tom
http://www.access.qbuilt.com/html/expert_contributors.html
__________________________________________

gbpg said:
It does work now (with currency as format) and I can multiply by the hours.

How would I add another field that is called [emp_trd_code] and select out
of this certain values for example T1 OR T2? I am not sure what the syntax is
for this despite Tom's reference to the Microsoft article.

Would this be to add in the paranthesis ("[first
field]","[secondfield]",'[emp_trd_code]=T1") I get an error.
 
G

gbpg

Hi Tom:

I appreciate the reference, it did help ...I just couldn't figure out the
arguments(my limitations). My apologies, your always a great resource and go
that extra mile (like offline). I wish I had rephrased the earlier post.

Tom Wickerath said:
Hi gbpg,

I'm glad to see that you are making some progress, per the later posts
you've made.
...despite Tom's reference to the Microsoft article.

The reference I gave was to The Access Web, which is not run by Microsoft.


Tom Wickerath
Microsoft Access MVP
https://mvp.support.microsoft.com/profile/Tom
http://www.access.qbuilt.com/html/expert_contributors.html
__________________________________________

gbpg said:
It does work now (with currency as format) and I can multiply by the hours.

How would I add another field that is called [emp_trd_code] and select out
of this certain values for example T1 OR T2? I am not sure what the syntax is
for this despite Tom's reference to the Microsoft article.

Would this be to add in the paranthesis ("[first
field]","[secondfield]",'[emp_trd_code]=T1") I get an error.
 
V

viktor kik

Douglas J. Steele said:
Since you're talking about a text field (as opposed to a numeric field), you
need quotes around the value:

=("[first field]","[secondfield]",'[emp_trd_code]='T1'")

To check for two possible values, you can either use the IN operator:

=("[first field]","[secondfield]",'[emp_trd_code] IN ('T1', 'T2')")

or you repeat the condition:

=("[first field]","[secondfield]",'[emp_trd_code]='T1' OR
[emp_trd_code]='T2'")

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


gbpg said:
It does work now (with currency as format) and I can multiply by the
hours.

How would I add another field that is called [emp_trd_code] and select out
of this certain values for example T1 OR T2? I am not sure what the syntax
is
for this despite Tom's reference to the Microsoft article.

Would this be to add in the paranthesis ("[first
field]","[secondfield]",'[emp_trd_code]=T1") I get an error.


Douglas J. Steele said:
It's likely the names you're using that's causing the confusion.

Your second argument (anotherfieldxxx) sounds like the name of a field in
a
table, whereas it has to be the name of a table or query.

If that's giving you a valid numeric value, though, I see no reason why

=-DSum("[one filed]","[anotherfieldxxx]") * 20

shouldn't work.


--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Ok I will show the expression more like the real thing:
The text box control source would be =-DSum("[one
filed]","[anotherfieldxxx]")
this works it gives me a total of the staff trained in those fields
(which
are boolean check boxes)

now I want to multiply this value by the hours it takes to complete the
training and then the cost of the course.


:

achieved by =-DSum("[xxxxxx]","[anotherfieldxxx]")

Your DSum expression does not look correct to me. What does the
"[xxxxxx]"
part represent. It should be the name of a field. The next part,
"[anotherfieldxxx]", should be the name of a table or query (the
Domain).

All domain aggregrate functions (DSum, DMax, DMin, DLookup, etc.)
share
the
same common parameters:

DFunction("Expression", "Domain", "OptionalCriteria")

Here is a good article on The Access Web for your reference:

DLookup Usage Samples
http://www.mvps.org/access/general/gen0018.htm


Tom Wickerath
Microsoft Access MVP
https://mvp.support.microsoft.com/profile/Tom
http://www.access.qbuilt.com/html/expert_contributors.html
__________________________________________

:

I have a report with some calculated fields that produce a sum of
values in a
query this is achieved by =-DSum("[xxxxxx]","[anotherfieldxxx]") I
need
to
multiply this by another value(i.e. 20.00 dollars and can't get this
to
work
not sure why
 

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