Total Calculated Fields in Query to Form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Following good counsel regarding calculated fields in tables:

I have "FlightHrs" as a calculated field in "qryFlightHrs".
I need to filter the query by the field "Engine" and then sum the field
"FlightHrs".
I would like to view this data in "txtboxCumEngHrs" on the form
"TempFlightInfo" on the land_afterUpdate event.

I created the query and even a report based on the above and i can view the
sum on the report. I do not know how to put this into the event above.

Any help would be appreciated.
 
Congradulations on the query; however, you don't need it. In a situation
where you want to return one distinct value, the DSum function will be less
code and will be faster. It should go in the land_afterUpdate event.

Me.txtboxCumEngHrs = DSum("[FlightHours]", "TableName", "[Engine] = '" &
Me.txtEngine & "'")

I am guessing at correct names, but you should be able to change to names to
be correct.
 
Thanks much. As always, I make things way too hard. But it's good practice
I guess?
--
Teach me to fish! Thanks for the help.
Pax, M


Klatuu said:
Congradulations on the query; however, you don't need it. In a situation
where you want to return one distinct value, the DSum function will be less
code and will be faster. It should go in the land_afterUpdate event.

Me.txtboxCumEngHrs = DSum("[FlightHours]", "TableName", "[Engine] = '" &
Me.txtEngine & "'")

I am guessing at correct names, but you should be able to change to names to
be correct.
--
Dave Hargis, Microsoft Access MVP


m stroup said:
Following good counsel regarding calculated fields in tables:

I have "FlightHrs" as a calculated field in "qryFlightHrs".
I need to filter the query by the field "Engine" and then sum the field
"FlightHrs".
I would like to view this data in "txtboxCumEngHrs" on the form
"TempFlightInfo" on the land_afterUpdate event.

I created the query and even a report based on the above and i can view the
sum on the report. I do not know how to put this into the event above.

Any help would be appreciated.
 
What I am proposing is good practice, if that is what you are asking.
--
Dave Hargis, Microsoft Access MVP


m stroup said:
Thanks much. As always, I make things way too hard. But it's good practice
I guess?
--
Teach me to fish! Thanks for the help.
Pax, M


Klatuu said:
Congradulations on the query; however, you don't need it. In a situation
where you want to return one distinct value, the DSum function will be less
code and will be faster. It should go in the land_afterUpdate event.

Me.txtboxCumEngHrs = DSum("[FlightHours]", "TableName", "[Engine] = '" &
Me.txtEngine & "'")

I am guessing at correct names, but you should be able to change to names to
be correct.
--
Dave Hargis, Microsoft Access MVP


m stroup said:
Following good counsel regarding calculated fields in tables:

I have "FlightHrs" as a calculated field in "qryFlightHrs".
I need to filter the query by the field "Engine" and then sum the field
"FlightHrs".
I would like to view this data in "txtboxCumEngHrs" on the form
"TempFlightInfo" on the land_afterUpdate event.

I created the query and even a report based on the above and i can view the
sum on the report. I do not know how to put this into the event above.

Any help would be appreciated.
 
Actually, I meant creating queries and reports was good practice for me. I
am sure what you proposed is good practice. I do appreciate the help!
--
Teach me to fish! Thanks for the help.
Pax, M


Klatuu said:
What I am proposing is good practice, if that is what you are asking.
--
Dave Hargis, Microsoft Access MVP


m stroup said:
Thanks much. As always, I make things way too hard. But it's good practice
I guess?
--
Teach me to fish! Thanks for the help.
Pax, M


Klatuu said:
Congradulations on the query; however, you don't need it. In a situation
where you want to return one distinct value, the DSum function will be less
code and will be faster. It should go in the land_afterUpdate event.

Me.txtboxCumEngHrs = DSum("[FlightHours]", "TableName", "[Engine] = '" &
Me.txtEngine & "'")

I am guessing at correct names, but you should be able to change to names to
be correct.
--
Dave Hargis, Microsoft Access MVP


:

Following good counsel regarding calculated fields in tables:

I have "FlightHrs" as a calculated field in "qryFlightHrs".
I need to filter the query by the field "Engine" and then sum the field
"FlightHrs".
I would like to view this data in "txtboxCumEngHrs" on the form
"TempFlightInfo" on the land_afterUpdate event.

I created the query and even a report based on the above and i can view the
sum on the report. I do not know how to put this into the event above.

Any help would be appreciated.
 
Back
Top