I have Drop down List from another Query on Category , I am trying show
Only records with"Apples" in [Category]and 3 other fields
Name,dtDate,Remark
Thanks for helping ......Bob
Assuming that funGetHorse isn't involved in this; and that the drop down
box
is a Combo Box named cboCategory and that it's on a form named MyForm
(none of
which I know to be the case, you'll need to adapt):
SELECT DISTINCT tblRemarks.Category,
funGetHorse(0,tblHorseInfo.HorseID,False) AS Name, tblRemarks.dtDate,
tblRemarks.HorseID, tblHorseInfo.Status, tblRemarks.Remark
FROM tblRemarks INNER JOIN tblHorseInfo ON tblRemarks.HorseID =
tblHorseInfo.HorseID
GROUP BY tblRemarks.Category, funGetHorse(0,tblHorseInfo.HorseID,False),
tblRemarks.dtDate, tblRemarks.HorseID, tblHorseInfo.Status,
tblRemarks.Remark
WHERE (((tblHorseInfo.Status) Like 'Active*'))
AND tblRemarks.Category = [Forms]![MyForm]![cboCategory]
ORDER BY tblRemarks.Category, funGetHorse(0,tblHorseInfo.HorseID,False);
I don't understand why you're using a Group By query though - you're not
counting, or totaling, or anything else that would need such a query, and
you're already using SELECT DISTINCT. If you remove the entire GROUP BY
clause
do you get the same results?
SELECT DISTINCT tblRemarks.Category,
funGetHorse(0,tblHorseInfo.HorseID,False) AS Name, tblRemarks.dtDate,
tblRemarks.HorseID, tblHorseInfo.Status, tblRemarks.Remark
FROM tblRemarks INNER JOIN tblHorseInfo ON tblRemarks.HorseID =
tblHorseInfo.HorseID
WHERE (((tblHorseInfo.Status) Like 'Active*'))
AND tblRemarks.Category = [Forms]![MyForm]![cboCategory]
ORDER BY tblRemarks.Category, funGetHorse(0,tblHorseInfo.HorseID,False);
Again... just in case this isn't yet clear... this operation is *NOT*
called
"sorting" by category. The
ORDER BY tblRemarks.Category
is sorting by category - putting the records that are retrieved into
alphabetical order by category. If you're just selecting one category, you
can
leave tblRemarks.Category out of the ORDER BY clause - if the records all
have
the same category then there's no need to sort them.
John W. Vinson [MVP]