Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can apply Me.OrderBy only to a filtered rst and not to all source rst?

Status
Not open for further replies.

Bresart

Programmer
Feb 14, 2007
314
ES
Hi, when done a searching in a form that gives a specific number of records smaller than the initial one, after that these smaller number of records and not all can be ordered with Me.OrderBy? If not, which way is the most suitable for ordering only a few records and not all from the source table, that is, when a filter is applied?

Thanks in advance.
 
Do you mean sort order?


Ian Mayor (UK)
Program Error
Always make your words sweet and nice. Because you never know when you may have to eat them.
 
Thanks ProgramError.

I mean ordering for example alphabetically according to a records field.
 
How are ya Bresart . . .
Bresart said:
[blue] . . . after that these smaller number of records and not all can be ordered with Me.OrderBy? If not, [purple]which way is the most suitable for ordering only a few records.[/purple][/blue]
Its [purple]academic![/purple] . . . Whether no records, one record, or many, perform the [blue]OrderBy![/blue]

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 
Thanks TheAceMan1.

OrderBy removes the filter when it exists, that is an inconvenience. With a smaller number of records i mean filtered records, that is, a number of records given after a search, that is smaller than the original number of records, before the search.

With OrderBy, all records are shown, and i need to order only the filtered records, not all records.
 
You may try something like this:
Code:
Dim strFilter As String
strFilter = Me.Filter
Me.OrderBy = "yourField"
Me.OrderByOn = True
Me.Filter = strFilter
Me.FilterOn = True

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thanks PHV.

I have checked now that Me.OrderBy keeps the filter.
 
Thanks PHV.

I have checked now that Me.OrderBy keeps the filter. So it works correctly just now. If the problem appears later, i would try the code

Dim strFilter As String
strFilter = Me.Filter
Me.OrderBy = "yourField"
Me.OrderByOn = True
Me.Filter = strFilter
Me.FilterOn = True


but, is there a way less ugly than this one (it would first show all records and after would apply the filter)?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top