Sort form and remove sort

W

Wes

Hello. Thanks in advance for the help.

I have a form linked to a query listing expenses. After opening, the
form filters based on a selection I make from a previous form.

Details:

Form Name: ExpensesAll
Original Query: ExpensesAllqry
Filter Queries: ExpensesNotSub
ExpensesSubmitted

I would like to add option buttons at the bottom that will allow me to
sort the information on the ExpensesAll form. For example, I have a
field called "Expense Type". I would like to be able to click the
option button and sort this information without having to highlight
the field.

Any ideas?

Thanks.
 
B

Bob Quintal

Hello. Thanks in advance for the help.

I have a form linked to a query listing expenses. After opening,
the form filters based on a selection I make from a previous form.

Details:

Form Name: ExpensesAll
Original Query: ExpensesAllqry
Filter Queries: ExpensesNotSub
ExpensesSubmitted

I would like to add option buttons at the bottom that will allow
me to sort the information on the ExpensesAll form. For example,
I have a field called "Expense Type". I would like to be able to
click the option button and sort this information without having
to highlight the field.

Any ideas?

Thanks.
In the button's on click event, set [Event Procedure] then click on
the ellipse (...) to the right. The VBA code editor will create the
sub procedure definition and end lines.

In between those two, add the following
Me.OrderBy = "[field name]" ' where field name gets replaced with
the name of the field you actually want to sort on.
Me.OrderByOn = true

That's all it takes.

You can get fancier
me.OrderBy = "[another field],[field name]"
or
me.OrderBy = "[ID] Desc"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top