Struggling with calculated field on form

L

liiza

I have a table that has a field for # of days used (tb_Labor), and another
table (Employees) that has a field for Cost perday, for each employee....I've
built a form and show the one field for the days, but want another that
calculates the cost perday * the # of days, once i enter something in the
days field. I know I shouldn't store this in a table, from all i've been
reading here, but do i need a field in a table in order to get the results??
I've tried a text box and so far I've gotten nothing, Name? and a little flag
that tells me the control source is wrong.

please help
 
G

Golfinray

I am not 100% sure how your data is set up, but normally I would use a
datediff command in my query to calculate hours.
Datediff("h"[yourfirstfield],[now()]) then use a formula as the control
source of a textbox like:
=sum([number of hours]*[cost per day])
 
L

liiza

I don' tknow if it makes a difference but I don't need the hours, all I want
is cost perday time number of days (costperday*days)... i put the sum that
you noted in the control box, now i get "Error" as an answer, and it puts it
in 2 rows.
One Table (Called Employees) Contains Fields: Employee_ID, First_Name,
Last_Name, Cost_per_day
The other table called tb_Labor Contains Fields: Employee_ID, Days (number
of), and Task Name.
In the form, i have the Employee's First and Last Name in one field, number
of days in a field and i want a third field that results in the number of
days * cost per day.

I hope this explains it better? thanks so much for your time and help


Golfinray said:
I am not 100% sure how your data is set up, but normally I would use a
datediff command in my query to calculate hours.
Datediff("h"[yourfirstfield],[now()]) then use a formula as the control
source of a textbox like:
=sum([number of hours]*[cost per day])

liiza said:
I have a table that has a field for # of days used (tb_Labor), and another
table (Employees) that has a field for Cost perday, for each employee....I've
built a form and show the one field for the days, but want another that
calculates the cost perday * the # of days, once i enter something in the
days field. I know I shouldn't store this in a table, from all i've been
reading here, but do i need a field in a table in order to get the results??
I've tried a text box and so far I've gotten nothing, Name? and a little flag
that tells me the control source is wrong.

please help
 
L

liiza

I forgot to add i have them in a relationship by the Employee ID, do i need
to link the query in some way to them too? to make it work?

liiza said:
I don' tknow if it makes a difference but I don't need the hours, all I want
is cost perday time number of days (costperday*days)... i put the sum that
you noted in the control box, now i get "Error" as an answer, and it puts it
in 2 rows.
One Table (Called Employees) Contains Fields: Employee_ID, First_Name,
Last_Name, Cost_per_day
The other table called tb_Labor Contains Fields: Employee_ID, Days (number
of), and Task Name.
In the form, i have the Employee's First and Last Name in one field, number
of days in a field and i want a third field that results in the number of
days * cost per day.

I hope this explains it better? thanks so much for your time and help


Golfinray said:
I am not 100% sure how your data is set up, but normally I would use a
datediff command in my query to calculate hours.
Datediff("h"[yourfirstfield],[now()]) then use a formula as the control
source of a textbox like:
=sum([number of hours]*[cost per day])

liiza said:
I have a table that has a field for # of days used (tb_Labor), and another
table (Employees) that has a field for Cost perday, for each employee....I've
built a form and show the one field for the days, but want another that
calculates the cost perday * the # of days, once i enter something in the
days field. I know I shouldn't store this in a table, from all i've been
reading here, but do i need a field in a table in order to get the results??
I've tried a text box and so far I've gotten nothing, Name? and a little flag
that tells me the control source is wrong.

please help
 
G

Golfinray

Then in a textbox put =sum([cost_per_day]*[days]) as the controlsource of the
box.

liiza said:
I don' tknow if it makes a difference but I don't need the hours, all I want
is cost perday time number of days (costperday*days)... i put the sum that
you noted in the control box, now i get "Error" as an answer, and it puts it
in 2 rows.
One Table (Called Employees) Contains Fields: Employee_ID, First_Name,
Last_Name, Cost_per_day
The other table called tb_Labor Contains Fields: Employee_ID, Days (number
of), and Task Name.
In the form, i have the Employee's First and Last Name in one field, number
of days in a field and i want a third field that results in the number of
days * cost per day.

I hope this explains it better? thanks so much for your time and help


Golfinray said:
I am not 100% sure how your data is set up, but normally I would use a
datediff command in my query to calculate hours.
Datediff("h"[yourfirstfield],[now()]) then use a formula as the control
source of a textbox like:
=sum([number of hours]*[cost per day])

liiza said:
I have a table that has a field for # of days used (tb_Labor), and another
table (Employees) that has a field for Cost perday, for each employee....I've
built a form and show the one field for the days, but want another that
calculates the cost perday * the # of days, once i enter something in the
days field. I know I shouldn't store this in a table, from all i've been
reading here, but do i need a field in a table in order to get the results??
I've tried a text box and so far I've gotten nothing, Name? and a little flag
that tells me the control source is wrong.

please help
 
L

liiza

I did that and it comes up with #Error in two rows, do i still need to do the
other expression you spoke of in a query?

Golfinray said:
Then in a textbox put =sum([cost_per_day]*[days]) as the controlsource of the
box.

liiza said:
I don' tknow if it makes a difference but I don't need the hours, all I want
is cost perday time number of days (costperday*days)... i put the sum that
you noted in the control box, now i get "Error" as an answer, and it puts it
in 2 rows.
One Table (Called Employees) Contains Fields: Employee_ID, First_Name,
Last_Name, Cost_per_day
The other table called tb_Labor Contains Fields: Employee_ID, Days (number
of), and Task Name.
In the form, i have the Employee's First and Last Name in one field, number
of days in a field and i want a third field that results in the number of
days * cost per day.

I hope this explains it better? thanks so much for your time and help


Golfinray said:
I am not 100% sure how your data is set up, but normally I would use a
datediff command in my query to calculate hours.
Datediff("h"[yourfirstfield],[now()]) then use a formula as the control
source of a textbox like:
=sum([number of hours]*[cost per day])

:

I have a table that has a field for # of days used (tb_Labor), and another
table (Employees) that has a field for Cost perday, for each employee....I've
built a form and show the one field for the days, but want another that
calculates the cost perday * the # of days, once i enter something in the
days field. I know I shouldn't store this in a table, from all i've been
reading here, but do i need a field in a table in order to get the results??
I've tried a text box and so far I've gotten nothing, Name? and a little flag
that tells me the control source is wrong.

please help
 
G

Golfinray

You don't need to do it unless you are trying to calculate hours. Are your
days just in numbers? They are not dates, right. That would be a different
problem. Make sure in your field list (one of your buttons in the toolbar
when you are in design view) shows both of these fields. In your tables in
design view, do you have days set as text or numbers? How about days? Also
try =sum([cost_per_day]*days)

liiza said:
I did that and it comes up with #Error in two rows, do i still need to do the
other expression you spoke of in a query?

Golfinray said:
Then in a textbox put =sum([cost_per_day]*[days]) as the controlsource of the
box.

liiza said:
I don' tknow if it makes a difference but I don't need the hours, all I want
is cost perday time number of days (costperday*days)... i put the sum that
you noted in the control box, now i get "Error" as an answer, and it puts it
in 2 rows.
One Table (Called Employees) Contains Fields: Employee_ID, First_Name,
Last_Name, Cost_per_day
The other table called tb_Labor Contains Fields: Employee_ID, Days (number
of), and Task Name.
In the form, i have the Employee's First and Last Name in one field, number
of days in a field and i want a third field that results in the number of
days * cost per day.

I hope this explains it better? thanks so much for your time and help


:

I am not 100% sure how your data is set up, but normally I would use a
datediff command in my query to calculate hours.
Datediff("h"[yourfirstfield],[now()]) then use a formula as the control
source of a textbox like:
=sum([number of hours]*[cost per day])

:

I have a table that has a field for # of days used (tb_Labor), and another
table (Employees) that has a field for Cost perday, for each employee....I've
built a form and show the one field for the days, but want another that
calculates the cost perday * the # of days, once i enter something in the
days field. I know I shouldn't store this in a table, from all i've been
reading here, but do i need a field in a table in order to get the results??
I've tried a text box and so far I've gotten nothing, Name? and a little flag
that tells me the control source is wrong.

please help
 
L

liiza

Wahoooooooooooooooooooooooooooo thank you!!! sorry to be so dense

Golfinray said:
You don't need to do it unless you are trying to calculate hours. Are your
days just in numbers? They are not dates, right. That would be a different
problem. Make sure in your field list (one of your buttons in the toolbar
when you are in design view) shows both of these fields. In your tables in
design view, do you have days set as text or numbers? How about days? Also
try =sum([cost_per_day]*days)

liiza said:
I did that and it comes up with #Error in two rows, do i still need to do the
other expression you spoke of in a query?

Golfinray said:
Then in a textbox put =sum([cost_per_day]*[days]) as the controlsource of the
box.

:

I don' tknow if it makes a difference but I don't need the hours, all I want
is cost perday time number of days (costperday*days)... i put the sum that
you noted in the control box, now i get "Error" as an answer, and it puts it
in 2 rows.
One Table (Called Employees) Contains Fields: Employee_ID, First_Name,
Last_Name, Cost_per_day
The other table called tb_Labor Contains Fields: Employee_ID, Days (number
of), and Task Name.
In the form, i have the Employee's First and Last Name in one field, number
of days in a field and i want a third field that results in the number of
days * cost per day.

I hope this explains it better? thanks so much for your time and help


:

I am not 100% sure how your data is set up, but normally I would use a
datediff command in my query to calculate hours.
Datediff("h"[yourfirstfield],[now()]) then use a formula as the control
source of a textbox like:
=sum([number of hours]*[cost per day])

:

I have a table that has a field for # of days used (tb_Labor), and another
table (Employees) that has a field for Cost perday, for each employee....I've
built a form and show the one field for the days, but want another that
calculates the cost perday * the # of days, once i enter something in the
days field. I know I shouldn't store this in a table, from all i've been
reading here, but do i need a field in a table in order to get the results??
I've tried a text box and so far I've gotten nothing, Name? and a little flag
that tells me the control source is wrong.

please help
 

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