Hope someone can help me solve this.

Also why won't Access 97 accept a function in the SELECT OR
what am I doing wrong?

PROBLEM:
Need min and max price for each day. Receiving Min and Max prices for each minute.

Ultimate objective is to obtain:

a. The first price of the day
b. The last price of the day
c. The highest price of the day
d. The lowest price of the day

-------------------
SAMPLE TABLES
--------------------

Date/Time fldTickPrice

8/31/00 08:00:00 Am 20.75

8/31/00 08:00:04 Am 20.65

8/31/00 08:00:25 Am 20.65

8/31/00 08:03:00 Am 25.50


-----------------------
Daily Table to which fldPrice query results will be posted:
--------------------------

Date fldOpenPrice fldHighPrice fldLowPrice fldLastPrice


--------------------------
Original QUERY which returns min and max for each minute
not each day.
---------------------------

PARAMETERS [pBegDate] DateTime, [pEndDate] DateTime;
SELECT fldTickDateTime, Min(fldTickPrice) AS [MinPrice], Max(fldTickPrice) AS [MaxPrice]
FROM SP1U
WHERE ((([fldTickDateTime]) Between [pBegDate] And [pEndDate]))
GROUP BY fldTickDateTime;


------------------------------
REVISED SUBROUTINE USING DateValue to extract date
from fldDateTime in order to try and GROUP BY Date

Returns aggregrate function error!!!
-------------------------------


Sub TestQuery()

On Error GoTo ErrorQuery

Dim qd As QueryDef
Dim qryName As String
Dim strSQL As String
Dim strParm As String
Dim rsQuery As Recordset
Dim TBLName As String
Dim BegLookUP As Date
Dim EndLookUP As Date
Dim junk As Integer

Set qd = New QueryDef


'qryName = "Query_UpDateDaily"
'qd.Name = qryName
TBLName = "SP1U"
strParm = "PARAMETERS [pBegDate] DateTime, [pEndDate] DateTime; "
strSQL = strParm & "SELECT fldTickDateTime, DateValue(fldTickDateTime) As TickDate, Min(fldTickPrice) AS MinPrice, Max(fldTickPrice) AS MaxPrice " _
& "FROM " & TBLName & " " _
& "WHERE ((([TickDate]) Between [pBegDate] And [pEndDate])) " _
& "GROUP BY TickDate;"

'Create a Temporary Query
Set qd = db.CreateQueryDef("", strSQL)

BegLookUP = #9/6/01 12:00:01 AM#
EndLookUP = #9/6/01 11:59:59 PM#

qd.Parameters("pBegDate").Value = BegLookUP
qd.Parameters("pEndDate").Value = EndLookUP

Set rsQuery = qd.OpenRecordset

With rsQuery
'See if Query Table is Empty
If .EOF And .BOF Then

'Not found
junk = 1

Else
' Call FoundSelected(qd)
junk = 1
End If

.Close
End With
Set rsQuery = Nothing

' Exit Sub

ErrorQuery:
End Sub


Thanks
David