This should get the last 2 records in your table:
select top 2 id_value, [date], value
from tblTest
order by id_value desc
The following assumes that you have the code to get your data and shows how you
can get the values and subract them in order to get your difference:
If ObjRS.RecordCount = 2 Then
'We have our 2 records. Get the value into var's
strID1 = ObjRS.Fields("id_value")
strDate1 = ObjRS.Fields("date")
strValue1 = ObjRS.Fields("value")
'Move to the second record.
strID2 = ObjRS.Fields("id_value")
strDate2 = ObjRS.Fields("date")
strValue2 = ObjRS.Fields("value")
'Destroy our recordset object.
set ObjRS = Nothing
'Get the diff between our 2 values.
Dim strDifference
strDifference = strValue2 - strValue1
'Display all your data!
End If
Mark
valter piso <[EMAIL PROTECTED]> wrote:
The Access db table (QUOTATIONS) has the following fields:
id_value date value
1 12/04 4.85
2 13/04 4.87
3 14/04 4.83
id_value is a "Counter" field
date is a "text" field
value is a "Numeric" field
The page layout should look like this:
previous value last value variation
4.87 4.83 (last value - previous
value) -0.04
So I need to know how to get the last 2 records of my table.
Actually I do not have a code to show coz all is based on this....
Thank you for your help,
Valter
Mark E <[EMAIL PROTECTED]> wrote:
Posting your code and database layout would help
tremendously.
Mark
--- Valter <[EMAIL PROTECTED]> wrote:
>
> Ok..lets explain better..
> Everyday I receive currency value which I store in a
> db and I show
> always the last one on my web page.
> What I need to do is to calculate the daily trend
> based on the absolute
> variation (last value - previous value) and show it
> on my page using
> gif symbols (arrow up, arrow down, stable). I do
> know how to create the
> if statements, I know how to get the last value but
> I do not know how
> to get the last value -1 (previous value).
> Hope this would be a bit clearer and can help you to
> understand better.
> Thank you
> Valter
>
>
>
>
---------------------------------
Yahoo! Groups Links
To visit your group on the web, go to:
http://groups.yahoo.com/group/AspClassicAnyQuestionIsOk/
To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
---------------------------------
Do you Yahoo!?
Yahoo! Small Business - Try our new resources site!
[Non-text portions of this message have been removed]
---------------------------------
Yahoo! Groups Links
To visit your group on the web, go to:
http://groups.yahoo.com/group/AspClassicAnyQuestionIsOk/
To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
[Non-text portions of this message have been removed]
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/AspClassicAnyQuestionIsOk/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/