calculate after first calculation

A

angellijah

how to I get one calculation to occur after another? I am getting errors on
the following:

Text4 = DCount("[Date Opened]", "[Client Info]", "[Date Opened] between
[text0] and [text2]")
Text12 = DCount("[Date of Completion]", "[Client Info]", "[Date of
Completion] between [text0] and [text2]")
Text14 = DCount("[Outcome]", "[Client Info]", "[Outcome]='Saved' and
([Date of Completion] between [text0] and [text2])")
Text16 = DSum("[term_value_amount]", "[Crystal Upload]",
"[Term_ent_date] between [text0] and [text2]")
Text40 = DSum("[Annual Revenue]", "[Client Info]", "[Outcome]='Lost' and
([Date of Completion] between [text0] and [text2])")
Text6 = DCount("
Code:
", "[Client Info]", "isnull([Date of Completion])")
Text8 = DCount("[Company_Code]", "[Crystal Upload]", "([Term_ent_date]
between [text0] and [text2])")
Text29 = DSum("[Term Value]", "[Client Info]", "[Term Date] between
[text0] and [text2]")
Text31 = DCount("[Code]", "[Client Info]", "[Term Date] between [text0]
and [text2]")
Text33 = DSum("[Annual Revenue]", "[Client Info]", "[Outcome]='Saved'
and ([Date of Completion] between [text0] and [text2])")
Text35 = DCount("[Outcome]", "[Client Info]", "[Outcome]='Lost' and
([Date of Completion] between [text0] and [text2])")
Text38 = [Text35] / [Text12]
Text18 = [Text29] / [Text16]
Text21 = [Text14] / [Text12]

I want the last three, text 38, 18, and 21 to occur after the other fields.
any suggestions?  This is the afterclick event on a command button.
 
D

Douglas J. Steele

The calculattions will always be done in the order in which you've written
them.

The overflow is because you're dividing by zero.

Text12 = DCount("[Date of Completion]", "[Client Info]", "[Date of
Completion] between [text0] and [text2]") is not valid. Assuming that text0
and text2 contain dates, you need

Text12 = DCount("[Date of Completion]", "[Client Info]", _
"[Date of Completion] between " & _
Format([text0], "\#yyyy\-mm\-dd\#) & _
" and " & Format([text2], "\#yyyy\-mm\-dd\#")

(you'll need to change all the other ones similarly)

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


angellijah said:
I am also getting the error message "overflow" after I click the button.

angellijah said:
how to I get one calculation to occur after another? I am getting errors
on
the following:

Text4 = DCount("[Date Opened]", "[Client Info]", "[Date Opened]
between
[text0] and [text2]")
Text12 = DCount("[Date of Completion]", "[Client Info]", "[Date of
Completion] between [text0] and [text2]")
Text14 = DCount("[Outcome]", "[Client Info]", "[Outcome]='Saved' and
([Date of Completion] between [text0] and [text2])")
Text16 = DSum("[term_value_amount]", "[Crystal Upload]",
"[Term_ent_date] between [text0] and [text2]")
Text40 = DSum("[Annual Revenue]", "[Client Info]", "[Outcome]='Lost'
and
([Date of Completion] between [text0] and [text2])")
Text6 = DCount("
Code:
", "[Client Info]", "isnull([Date of
Completion])")
Text8 = DCount("[Company_Code]", "[Crystal Upload]",
"([Term_ent_date]
between [text0] and [text2])")
Text29 = DSum("[Term Value]", "[Client Info]", "[Term Date] between
[text0] and [text2]")
Text31 = DCount("[Code]", "[Client Info]", "[Term Date] between
[text0]
and [text2]")
Text33 = DSum("[Annual Revenue]", "[Client Info]", "[Outcome]='Saved'
and ([Date of Completion] between [text0] and [text2])")
Text35 = DCount("[Outcome]", "[Client Info]", "[Outcome]='Lost' and
([Date of Completion] between [text0] and [text2])")
Text38 = [Text35] / [Text12]
Text18 = [Text29] / [Text16]
Text21 = [Text14] / [Text12]

I want the last three, text 38, 18, and 21 to occur after the other
fields.
any suggestions?  This is the afterclick event on a command button.[/QUOTE][/QUOTE]
 

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