field calculation resulting as 0

G

Guest

Hi,

Trying to calculated the number of vacation-days left for each employee.
The results comes up as 0 in every employee records. Why?

Fields are:
#MonthsWorked : =DateDiff("m",[Datehired],Date())
#DaysAccumulated: =[#MonthsWorked]*2.5
#DaysTaken: manual entry
and thefield where I get the wrong result:
#DaysLeft: =Sum([#DayAccumulated]-[#DaysTalen]) - this calculation is
returning 0 in every records.

THanks!
 
G

Guest

Hi,

Sum is not required to carry out the calculation;
Me.#DaysLeft: =Me.#DayAccumulated - Me.#DaysTaken

the Me. part is assuming they are field names rather than dimmed variables,
if they are dimmed variables obviously remove the Me. part!

TonyT..
 
G

Guest

I tried the suggested formula but it returns #Name?
FYI, I use the Expression builder to enter the formula as I'm not a
programmer.
Any other suggestions?

I wonder; since the field #DaysAccumulated is a calculated field, would that
be cause for the error?

Thanks!
--
Marg


TonyT said:
Hi,

Sum is not required to carry out the calculation;
Me.#DaysLeft: =Me.#DayAccumulated - Me.#DaysTaken

the Me. part is assuming they are field names rather than dimmed variables,
if they are dimmed variables obviously remove the Me. part!

TonyT..

margot_eon said:
Hi,

Trying to calculated the number of vacation-days left for each employee.
The results comes up as 0 in every employee records. Why?

Fields are:
#MonthsWorked : =DateDiff("m",[Datehired],Date())
#DaysAccumulated: =[#MonthsWorked]*2.5
#DaysTaken: manual entry
and thefield where I get the wrong result:
#DaysLeft: =Sum([#DayAccumulated]-[#DaysTalen]) - this calculation is
returning 0 in every records.

THanks!
 
G

Guest

Hi again,

How did you try it, with the Me. part or without, I think (never use
Expression builder myself) you should have;
#DaysLeft: =[#DayAccumulated]-[#DaysTalen]

If you still get 0 then remove the DaysTaken half of the calculation to
check that DaysAccumulted is retuirning a valid number.

good luck,

TonyT..


margot_eon said:
I tried the suggested formula but it returns #Name?
FYI, I use the Expression builder to enter the formula as I'm not a
programmer.
Any other suggestions?

I wonder; since the field #DaysAccumulated is a calculated field, would that
be cause for the error?

Thanks!
--
Marg


TonyT said:
Hi,

Sum is not required to carry out the calculation;
Me.#DaysLeft: =Me.#DayAccumulated - Me.#DaysTaken

the Me. part is assuming they are field names rather than dimmed variables,
if they are dimmed variables obviously remove the Me. part!

TonyT..

margot_eon said:
Hi,

Trying to calculated the number of vacation-days left for each employee.
The results comes up as 0 in every employee records. Why?

Fields are:
#MonthsWorked : =DateDiff("m",[Datehired],Date())
#DaysAccumulated: =[#MonthsWorked]*2.5
#DaysTaken: manual entry
and thefield where I get the wrong result:
#DaysLeft: =Sum([#DayAccumulated]-[#DaysTalen]) - this calculation is
returning 0 in every records.

THanks!
 
G

Guest

Hi Tony,
I tried:
Me.#DaysLeft = Me.#DayAccumulated - Me.#DaysTaken - returns #Name? In the
Expression Builder, by default, it adds a = sign in front of the whole
formula, making it look like this: =Me.#DaysLeft: =Me.#DayAccumulated -
Me.#DaysTaken
therefore making the formula wrong.
And:
=me.#DayAccumulated-me.#DaysTaken - returns #Name?
And:
=[#DayAccumulated]-[#DaysTaken] - returns #Name? as well.
And:
=Sum([employee info]!#DayAccumulated-[employee info]!#DaysTaken) - return 0
And:
=Sum([#DayAccumulated]-[#DaysTaken]) - returns and empty field

The formula in #DayAccumulated is returning a valid number.

I'm out of ideas!!
Thanks.

--
Marg



TonyT said:
Hi again,

How did you try it, with the Me. part or without, I think (never use
Expression builder myself) you should have;
#DaysLeft: =[#DayAccumulated]-[#DaysTalen]

If you still get 0 then remove the DaysTaken half of the calculation to
check that DaysAccumulted is retuirning a valid number.

good luck,

TonyT..


margot_eon said:
I tried the suggested formula but it returns #Name?
FYI, I use the Expression builder to enter the formula as I'm not a
programmer.
Any other suggestions?

I wonder; since the field #DaysAccumulated is a calculated field, would that
be cause for the error?

Thanks!
--
Marg


TonyT said:
Hi,

Sum is not required to carry out the calculation;
Me.#DaysLeft: =Me.#DayAccumulated - Me.#DaysTaken

the Me. part is assuming they are field names rather than dimmed variables,
if they are dimmed variables obviously remove the Me. part!

TonyT..

:

Hi,

Trying to calculated the number of vacation-days left for each employee.
The results comes up as 0 in every employee records. Why?

Fields are:
#MonthsWorked : =DateDiff("m",[Datehired],Date())
#DaysAccumulated: =[#MonthsWorked]*2.5
#DaysTaken: manual entry
and thefield where I get the wrong result:
#DaysLeft: =Sum([#DayAccumulated]-[#DaysTalen]) - this calculation is
returning 0 in every records.

THanks!
 
G

Guest

ummmm, can you not put;

Me.[#DaysLeft:] = Iif(Not
IsNull(Me.[#DayAccumulated]),Me.[#DayAccumulated],0) - Iif(Not
IsNull(Me.[#DaysTaken]),Me.[#DaysTaken],0)

In the afterUpdate event of each of the 2 textboxes concerned in vba?
and scrap the expression builder part entirely?

sorry, as I said previously, the expression builder is not my strongest
point:p

TonyT..

margot_eon said:
Hi Tony,
I tried:
Me.#DaysLeft = Me.#DayAccumulated - Me.#DaysTaken - returns #Name? In the
Expression Builder, by default, it adds a = sign in front of the whole
formula, making it look like this: =Me.#DaysLeft: =Me.#DayAccumulated -
Me.#DaysTaken
therefore making the formula wrong.
And:
=me.#DayAccumulated-me.#DaysTaken - returns #Name?
And:
=[#DayAccumulated]-[#DaysTaken] - returns #Name? as well.
And:
=Sum([employee info]!#DayAccumulated-[employee info]!#DaysTaken) - return 0
And:
=Sum([#DayAccumulated]-[#DaysTaken]) - returns and empty field

The formula in #DayAccumulated is returning a valid number.

I'm out of ideas!!
Thanks.

--
Marg



TonyT said:
Hi again,

How did you try it, with the Me. part or without, I think (never use
Expression builder myself) you should have;
#DaysLeft: =[#DayAccumulated]-[#DaysTalen]

If you still get 0 then remove the DaysTaken half of the calculation to
check that DaysAccumulted is retuirning a valid number.

good luck,

TonyT..


margot_eon said:
I tried the suggested formula but it returns #Name?
FYI, I use the Expression builder to enter the formula as I'm not a
programmer.
Any other suggestions?

I wonder; since the field #DaysAccumulated is a calculated field, would that
be cause for the error?

Thanks!
--
Marg


:

Hi,

Sum is not required to carry out the calculation;
Me.#DaysLeft: =Me.#DayAccumulated - Me.#DaysTaken

the Me. part is assuming they are field names rather than dimmed variables,
if they are dimmed variables obviously remove the Me. part!

TonyT..

:

Hi,

Trying to calculated the number of vacation-days left for each employee.
The results comes up as 0 in every employee records. Why?

Fields are:
#MonthsWorked : =DateDiff("m",[Datehired],Date())
#DaysAccumulated: =[#MonthsWorked]*2.5
#DaysTaken: manual entry
and thefield where I get the wrong result:
#DaysLeft: =Sum([#DayAccumulated]-[#DaysTalen]) - this calculation is
returning 0 in every records.

THanks!
 
G

Guest

Hello Tony,

Thanks but this does not help me as I need to find a solution for this and I
will not start to learn programming in VBA today!!
Can you pass my request to someone who is familiar with Expression builder?

Thank you!
--
Marg


TonyT said:
ummmm, can you not put;

Me.[#DaysLeft:] = Iif(Not
IsNull(Me.[#DayAccumulated]),Me.[#DayAccumulated],0) - Iif(Not
IsNull(Me.[#DaysTaken]),Me.[#DaysTaken],0)

In the afterUpdate event of each of the 2 textboxes concerned in vba?
and scrap the expression builder part entirely?

sorry, as I said previously, the expression builder is not my strongest
point:p

TonyT..

margot_eon said:
Hi Tony,
I tried:
Me.#DaysLeft = Me.#DayAccumulated - Me.#DaysTaken - returns #Name? In the
Expression Builder, by default, it adds a = sign in front of the whole
formula, making it look like this: =Me.#DaysLeft: =Me.#DayAccumulated -
Me.#DaysTaken
therefore making the formula wrong.
And:
=me.#DayAccumulated-me.#DaysTaken - returns #Name?
And:
=[#DayAccumulated]-[#DaysTaken] - returns #Name? as well.
And:
=Sum([employee info]!#DayAccumulated-[employee info]!#DaysTaken) - return 0
And:
=Sum([#DayAccumulated]-[#DaysTaken]) - returns and empty field

The formula in #DayAccumulated is returning a valid number.

I'm out of ideas!!
Thanks.

--
Marg



TonyT said:
Hi again,

How did you try it, with the Me. part or without, I think (never use
Expression builder myself) you should have;
#DaysLeft: =[#DayAccumulated]-[#DaysTalen]

If you still get 0 then remove the DaysTaken half of the calculation to
check that DaysAccumulted is retuirning a valid number.

good luck,

TonyT..


:

I tried the suggested formula but it returns #Name?
FYI, I use the Expression builder to enter the formula as I'm not a
programmer.
Any other suggestions?

I wonder; since the field #DaysAccumulated is a calculated field, would that
be cause for the error?

Thanks!
--
Marg


:

Hi,

Sum is not required to carry out the calculation;
Me.#DaysLeft: =Me.#DayAccumulated - Me.#DaysTaken

the Me. part is assuming they are field names rather than dimmed variables,
if they are dimmed variables obviously remove the Me. part!

TonyT..

:

Hi,

Trying to calculated the number of vacation-days left for each employee.
The results comes up as 0 in every employee records. Why?

Fields are:
#MonthsWorked : =DateDiff("m",[Datehired],Date())
#DaysAccumulated: =[#MonthsWorked]*2.5
#DaysTaken: manual entry
and thefield where I get the wrong result:
#DaysLeft: =Sum([#DayAccumulated]-[#DaysTalen]) - this calculation is
returning 0 in every records.

THanks!
 

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