Display last entered record (1 Viewer)

sahil

Registered User.
Local time
Today, 23:57
Joined
Jan 12, 2004
Messages
19
Hi,
I have a table "Scores" in which I have the fields "Date" and "Location". I have a form "frmscores" which is used to enter today's scores. The fields on this form are as follows:
1. combo box "cmb_location" for selecting the location,
2. text feild "txt_score" for entering the score and
3. another text field "txt_previous" which displays the last updated score for that location (button cmdSave to save the record).

Now when the user selects a particular location, I have to write a code in the after_update event of the Combo so that it displays me the previous score of that location in the "txt_previous". I have tried using clause where location=cmb_location.value and date=date-1 but this will work only if there is a entry everyday and will not work for saturday and sunday(when there will be no entry).

I have to write a code to display the last updated score (last entered score) for the location selected. Please help?
 

neileg

AWF VIP
Local time
Today, 23:57
Joined
Dec 4, 2002
Messages
5,975
You should look at using the MAX function. In a query, you can make this a totals query, and instead of selecting SUM, select MAX. Alternatively, in your form you can use DMax() to get the value from a table or query.
 

Users who are viewing this thread

Top Bottom