hi
sorting inside the query definition is useless, if you're using it as
recordsource for a report
to sort records in a report, use View->sorting and grouping in the report
design mode
to your second question, you can fill the query parameters from code, but a
much faster way is to apply a filter in the open event of the report
if you know the value that filters the report at the time you request the
openreport command, then you can send that value in the OpenArgs variable
listed at the end of the parameters of the DoCmd.OpenReport (that is if youre
using access XP and above)
then add these lines in the report_Open event:
me.filter="[the field on which you want to filter]=" & me.OpenArgs
me.FilterOn=True
remember that if the field is of type string, you need to add quotes before
and after the value
hope it all makes sense to you
good luck
Erez