Report name is "Lesson Learned shell"
field name is "Client"
I would like to sort in ascending order
I had asked for information on what the filter was. If it was placed
in the filter argument or where clause argument.
Sorting has nothing to do with the above.
How do you wish to filter the report?
By [Client] = what?
Does your query have parameters?
Is the query the record source for the report.
Copy down and post the macro name and actions.
By the way, sorting in a report should be done in the Report's Sorting
and Grouping dialog.
Open the Report in Design view.
Click on View + Sorting and Grouping.
Let's do this using code.
I'll have to make a bunch of guesses here.
I'll assume you have a table or a query as report's record source.
I'll also assume you want to open the report from a form, and filter
the records in the report by using a field on the form that is
displaying the client wanted.
I'll also need to assume that your [Client] field is actually a
ClientID field (regardless of what name you gave it) and has a unique
ID value to identify the correct client, so that no 2 clients have the
same ID.
Add a command button to your form (do Not use the Wizard).
Display the command button's property sheet.
Click on the Events tab.
On the Click event line write
[Event Procedure]
Then click on the button with the 3 dots that appears on that line.
The Code window will open with the cursor positioned between 2 already
existing lines.
Between those 2 lines write:
On Error GoTo Err_Handler
DoCmd.OpenReport ""Lesson Learned shell", acViewPreview,
,"[ClientIDfield ] = " & Me!ClientIDControl
Exit_This_Sub:
Exit Sub
Err_Handler:
MsgBox "Error #: " & err.Number & " " & err.Description
Resume Exit_This_Sub
That's all you need ... IF....
The Client field is unique, is a Number datatype, and is displayed in
the active record shown on your form.
If the [ClientID] field is actually a Text datatype, then change the
above to:
DoCmd.OpenReport ""Lesson Learned shell", acViewPreview, ,
"[ClientIDField] = '" & Me!ClientIDControl & "'"
If the above assumptions are correct, clicking the command button
should open your report and display just records for the client shown
in the form.