Hi,
My query still looks right to me. Can you provide some sample data (it doesn't have to be "real", just the right kind to illustrate the problem)? I can't test on anything without some sample data and I'm afraid if I create my own I would still be making some mistake in my understanding of these tables and what is in them.
SELECT
DR.Prop_KEY,
C.CommentDate,
Max(DR.Field9) AS MaxOfField9
FROM
tblDailyReadings AS DR
INNER JOIN tblComments AS C
ON DR.Prop_KEY = C.WH_IDX
GROUP BY
DR.Prop_KEY, C.CommentDate;
SELECT
DR.Prop_KEY,
DR.ReadingDate,
IIf([MaxOfField9]<1,1,[MaxOfField9]) AS MaxValComment
FROM
tblDailyReadings AS DR
LEFT JOIN qry_001_MaxOfField9 AS Q
ON
(DR.ReadingDate = Q.CommentDate)
AND
(DR.Prop_KEY = Q.Prop_KEY);
Set param = cmd.CreateParameter("Enter ID", adInteger, adParamInput, 5)
WHERE ID = [ID]
Code:
Set param = cmd.CreateParameter("Enter ID", adInteger, adParamInput, 5)
How might you alter the line above if you're setting the param.Value in the next line (my_var)?
Set param = cmd.CreateParameter("Enter ID", adInteger, adParamInput, 5)
param = my_var
Also, in order to use a parameter query in ADO, must the query exist in the Access database? OR can you create a parameter query in ADO directly using SQL? If so, how might that SQL code look? Is it as simple as adding [ and ] to a field name in a WHERE clause? LIke:
Code:
WHERE ID = [ID]
my_var = 5
my_sql = "SELECT * FROM Table1 WHERE ID = " & my_var