sorting

  • Thread starter auujxa2 via AccessMonster.com
  • Start date
A

auujxa2 via AccessMonster.com

I have a reporting form, which has dozens of reports that can be printed,
viewed or exported, based upon what you select from the combo boxes.

I'd like to have a combo box with several fields from the master table listed,
so they can choose what field they'd like to sort by.

The only current way I can think of doing this, is creating multiple queries,
each one sorted by a different field, then depending on what the value is
from the combo box, use that specific query for the report to print, export
or view.

Is there an easier or more efficient way to sort by one selected field,
instead of building a query for each selection?

Thank you in advance
 
D

Douglas J. Steele

Unfortunately, that won't work: reports don't get their sort order from
their recordsource, but instead from the Sorting and Grouping inside the
report.

See what Allen Browne has at http://www.allenbrowne.com/ser-33.html for how
to control the sort order of reports.
 
A

auujxa2 via AccessMonster.com

I can't believe I didn't think of that. (the sorting not working) Thanks so
much for the help and quick response. PERFECT!
Unfortunately, that won't work: reports don't get their sort order from
their recordsource, but instead from the Sorting and Grouping inside the
report.

See what Allen Browne has at http://www.allenbrowne.com/ser-33.html for how
to control the sort order of reports.
I have a reporting form, which has dozens of reports that can be printed,
viewed or exported, based upon what you select from the combo boxes.
[quoted text clipped - 14 lines]
Thank you in advance
 
A

auujxa2 via AccessMonster.com

There is no sorting or grouping error message pops up.

Select Case Forms!frmWelcome!cboSortStore

Case "Clearance Inventory Unit SellThru"
Me.GroupLevel(0).ControlSource = "Clearance Inventory Unit SellThru"
Me.GroupLevel(0).SortOrder = True
Me.GroupLevel(1).ControlSource = "DCSort"
Me.GroupLevel(1).SortOrder = True
Unfortunately, that won't work: reports don't get their sort order from
their recordsource, but instead from the Sorting and Grouping inside the
report.

See what Allen Browne has at http://www.allenbrowne.com/ser-33.html for how
to control the sort order of reports.
I have a reporting form, which has dozens of reports that can be printed,
viewed or exported, based upon what you select from the combo boxes.
[quoted text clipped - 14 lines]
Thank you in advance
 
D

Douglas J. Steele

??

Sorry, I don't understand what you're saying. Do you mean that an error
message is appearing when you use that code? The two groups must be
predefined before you can refer to them.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


auujxa2 via AccessMonster.com said:
There is no sorting or grouping error message pops up.

Select Case Forms!frmWelcome!cboSortStore

Case "Clearance Inventory Unit SellThru"
Me.GroupLevel(0).ControlSource = "Clearance Inventory Unit SellThru"
Me.GroupLevel(0).SortOrder = True
Me.GroupLevel(1).ControlSource = "DCSort"
Me.GroupLevel(1).SortOrder = True
Unfortunately, that won't work: reports don't get their sort order from
their recordsource, but instead from the Sorting and Grouping inside the
report.

See what Allen Browne has at http://www.allenbrowne.com/ser-33.html for
how
to control the sort order of reports.
I have a reporting form, which has dozens of reports that can be printed,
viewed or exported, based upon what you select from the combo boxes.
[quoted text clipped - 14 lines]
Thank you in advance
 
A

auujxa2 via AccessMonster.com

i thought that's what control source was doing?
Me.GroupLevel(0).ControlSource = "Clearance Inventory Unit SellThru"

??

Sorry, I don't understand what you're saying. Do you mean that an error
message is appearing when you use that code? The two groups must be
predefined before you can refer to them.
There is no sorting or grouping error message pops up.
[quoted text clipped - 19 lines]
 
A

auujxa2 via AccessMonster.com

I'm missing something. I'm trying to sort on the simplest form. The current
value of the combo box of the example below is 1. So, Case 1 should work
(which I believe it did, since it's debugging grouplevel 0 within case 1.
It's still saying I need to define it, which I'm unclear about. I thought
the ControlSource = "Clearance Inventory Unit SellThru" does that. The field
on the report I want sorted by is "Clearance Inventory Unit SellThru"

Select Case Forms!frmWelcome!cboSortStore
Case 1
Me.GroupLevel(0).ControlSource = "Clearance Inventory Unit SellThru"
Case 2
Me.GroupLevel(0).ControlSource = "Units Sold"
End Select
??

Sorry, I don't understand what you're saying. Do you mean that an error
message is appearing when you use that code? The two groups must be
predefined before you can refer to them.
There is no sorting or grouping error message pops up.
[quoted text clipped - 19 lines]
 
D

Douglas J. Steele

As I implied previously, you must create the groups through the Grouping and
Sorting dialog in the first place. Only once they've been created can you
then change them.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


auujxa2 via AccessMonster.com said:
I'm missing something. I'm trying to sort on the simplest form. The
current
value of the combo box of the example below is 1. So, Case 1 should work
(which I believe it did, since it's debugging grouplevel 0 within case 1.
It's still saying I need to define it, which I'm unclear about. I thought
the ControlSource = "Clearance Inventory Unit SellThru" does that. The
field
on the report I want sorted by is "Clearance Inventory Unit SellThru"

Select Case Forms!frmWelcome!cboSortStore
Case 1
Me.GroupLevel(0).ControlSource = "Clearance Inventory Unit
SellThru"
Case 2
Me.GroupLevel(0).ControlSource = "Units Sold"
End Select
??

Sorry, I don't understand what you're saying. Do you mean that an error
message is appearing when you use that code? The two groups must be
predefined before you can refer to them.
There is no sorting or grouping error message pops up.
[quoted text clipped - 19 lines]
Thank you in advance
 

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