Calculatiuon

ddrew

seasoned user
Local time
Today, 17:43
Joined
Jan 26, 2003
Messages
911
I have a continuous form. One of the fields is a textbox in date format. I want to have a calculated field in the form footer (which is also in date format) he calculation is the date field from the last record in the table + Me.AverageDays (this is another calculated textbox in the footer that I have already done.)

Could somebody help me out please?
 
from the last record in the table
You need to define 'last' which on its own is meaningless - do you mean latest entered, the latest date or what?

to calculate, I would use Dlookup which would be something like this pseudo code - this works for the latest entered record

Code:
=Dlookup("myDate","myTable","[ID]=" & dmax("ID",myTable))
 
Hi sorry for the delay in answering (work commitments!).

In answer to your question.

I need the calculation to take the last Date (DateStart) from (tbl_Seasons), it has a (Season_ID) if its any help and add the number form the field (AverageDays) to give a new date in (txt_PredictedStartDate) which is in the form footer (as are all the calculated fields.
 
so you are saying you want the date that is in the record with the highest SeasonID?

Adapting my psuedo code you would have this

Code:
=Dlookup("DateStart","tbl_Seasons","[SeasonID]=" & dmax("SeasonID","tbl_Seasons"))+[AverageDays]
 
Last edited:
OK I put the code in on the txtbox but its gone nuts and is flashing and showing error
 
that is very helpful:rolleyes: Suggest you remove the code and try something else
 
When I do calculations in the form footer, like average days and max of date, I do the following:

Instead of creating another field that combines these calculations, I have to use the names of these fields, text1 and text 2.

I've uploaded a sample that shows you what I'm talking about.

Hope it helps.
 

Attachments

Now that I have the time, I have attached a stripped down version of the database to show you what is happening.

I would have put it up last night but didn't have the time.
 

Attachments

Because the field name is not [SeasonID] but [Season_ID].
Code:
=DLookUp("DateStart";"tbl_Seasons";"[Season_ID]=" & DMax("Season_ID";"tbl_Seasons"))+[AverageDays]
 

Users who are viewing this thread

Back
Top Bottom