In message of Sat, 30 Sep 2006, Bob Barrows [MVP] writes
[quoted text, click to view] >David Floyd wrote:
>> I want to include in a web page a statement something like:
>> "The above data was last modified on nn/nn/nnnn"
>>
>> Using MSAccess I see that on the Tables window and using the 'Details'
>> icon or the 'properties' icon for the table in question there is a
>> modified date recorded.
>
>That property does not refer to the data in the table: it refers only to the
>table design.
>If you need to track the data modifications, you will need to add a
>DateModified field to the table and query it using Max(DateModified)
>
I can't get this to work, my code (amended extraction) is:
<%
Dim objConn,db,DataConn
Set objConn = Server.CreateObject("ADODB.Connection")
DataConn = Server.MapPath("..\private\MyDataBase.mdb;")
objConn.Open "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=" & DataConn
Dim objRS
Dim strSQL
Dim dateModified
strSQL = "SELECT MAX(dateModified) FROM [Full Details Query] WHERE
county = '"& county &"'"
Set objRS = objConn.Execute(strSQL)
dateModified = objRS("dateModified").value
response.write(dateModified)
%>
I then receive this error:
Error Type:
ADODB.Recordset (0x800A0CC1)
Item cannot be found in the collection corresponding to the requested
name or ordinal.
Whereas:
If I change the strSQL line to:
strSQL = "SELECT * FROM [Full Details Query] WHERE county = '"& county
&"' ORDER BY dateModified DESC"
it works, but it does seem a long winded way to get there.
I'm wondering why my line using MAX doesn't work.
Thanks for any help