mtagliaferri
10-06-2008, 04:52 AM
Hi, I am trying to solve one of my many problems, I have my frmTrip containing a sfrmFlight. On the sfrmFlight the user enters the number of flying hours in FlightTime the total of the FlightTime is calculated at the bottom of the sfrmFlight in a box named TotFlightTime the calculated value is shown on the frmTrip in a field named Flying Time Calculated, I need this value to be copied in my table tblTrip in the field FlyingTime so I can use query linked to the table tblTrip for other functions
I believe I have to use the afterUpdate but these are calculated values.
Anybody has a simple solution
Thanks
M
KenHigg
10-06-2008, 05:03 AM
I would recommend deveoping a function that calculates this on the fly and not store it as that's kinda bad juju in the database world...
At a minimum you could use a built-in domain function like dsum()...
mtagliaferri
10-06-2008, 05:20 AM
I thought the best option was to keep fundamental data on the main table that I ise for many statistics, would I be able with the DSUM to have the result as a permanent value on the tblTrip?
Thank
Marco
speakers_86
10-10-2008, 05:51 PM
You could use an update query for this. Use docmd openquery(YourQueryHere) in the on close event.
mtagliaferri
10-11-2008, 12:25 PM
I think my issue is bit more complicated, in the attachment I have the form frmTrip which has in the tab Trip Details a field named flying Time Calc which get the result from a linked sfrmFlight, basically I have one record in trips that contain many records of flights the sum of the flight time in flights has to be copied in a field in the table trip.
In the picture attached the total of flight time in the circles need to be copied in the field of records 170,171 and so on...
Thanks
Marco
speakers_86
10-11-2008, 12:37 PM
Make a query to sum(flight time). Then change this query to an update query to add that sum to the corresponding trip id.
If its more complicated than that, then I dont understand what you mean.
mtagliaferri
10-17-2008, 07:26 AM
I have buod the update qry, when I try to run it gives me an error "Operation must use an updateble query"