Re: "Sort" a combination of letters and numbers e.g. 20, 21a,200,



Hi Marsh,

Sorry it's been a while but I have real work to do and I have to fit my
database in as I can.

Right. The sorting for the report works beautifully, however, any VBA code
I can get for reference and helping me to learn is most welcome. To that
end: The Report is called "Register" and the columns I want to sort on are
"Area" (which contains alphanumeric values) and Tag (numeric values).
Sometimes I will want to sort by a) area and then b) Tag, but sometimes I
will just want to sort by Tag.

Can I come back to you later when I have tried your second answer in several
ways? I haven't got it to work yet, but that my be due to the way the query
is set up.

Cheers

Crazy Lady

"Marshall Barton" wrote:

> But, Lady, that's not "code", it's just a trivial expression
> in one line of the Sorting and Grouping window. The second
> one is just a field name selected from the field/expression
> drop down list. It sounds like you may be unfamiliar with
> using Sorting and Grouping (View menu). If so, take a
> little time out from making extra work for yourself and get
> familiar with this powerful, but easy to use feature of
> Access reports. Then give my earlier suggestion a try.
>
> Note that, unlike forms, anything beyond a trivial report
> **must** use Sorting and Grouping to specify it's sorting.
> Changing this according to user input requires a small
> amount of real VBA code. If your up to it, post back with
> specific details for a specific report and I'll provide some
> code for you to try.
>
> As to your other question, you can use a slightly more
> complex expression (not code) to cause your form's record
> source **query** to be sorted in either of two ways. First,
> some form's control (text box, check box, combo box, etc)
> should be used to allow the users to specify which sort they
> want. Since you didn't provide much in the way of clues to
> your requirements, I can only provide the general idea.
> Add a calculated field to the query:
> SortVal:IIf(Forms!someform.somecontrol = val1,fieldA,fieldB)
> --
> Marsh
> MVP [MS Access]
>
>
> Crazy Lady wrote:
> >Thanks for replying Marshall. I don't think this helps me, because I don't
> >know how to use code. I only have one piece of code in my database so far,
> >and that was given to me on this site.
> >
> >If you wouldn't mind eleborating I would be very grateful.
> >
> >You may be able to help further. I am wanting to sort in a report mainly,
> >but possibly also in a form and there are two possible sort criteria. I may
> >want to sort by this field or by another. I was intending to create two
> >reports sorted in those two ways and have a prompt ask which report to show.
> >Is there a better way?
> >
> >
> >> Crazy Lady wrote:
> >> >The numbers represent buildings and are stored as text. The Sort Ascending
> >> >and Decending option sorts the numbers only first and then the
> >> >numbers/letters. I want the list to end up as 20, 21a, 105c, 200.
> >>
> >>
> >"Marshall Barton" wrote:
> >> You can sort on expressions, not just fields.
> >>
> >> Try setting two levels of sort in Sorting and Grouping to:
> >> =Val(numfield)
> >> numfield
>
.



Relevant Pages

  • RE: Sorting Dates
    ... If you want to sort on the date field, it should be a date data type. ... sorting or using in calculations. ... I am trying to re-do the report as we speak. ... "Duane Hookom" wrote: ...
    (microsoft.public.access.reports)
  • Re: sorting
    ... When I sort the data using SQL, ... But this is just the sorting. ... If it were me I would query the database and bring back the ...
    (microsoft.public.vb.enterprise)
  • Re: "Convert in Integer" for MA or any guru, please!
    ... I thought you only wanted to sort the report by this value. ... in the sorting and grouping expression/field. ...
    (microsoft.public.access.reports)
  • Re: Selecting records matching user input
    ... Report order is controlled by the Sorting and Grouping dialog of the report. ... What I meant by SOMETIMES the sort order of the query works is just that. ... I have removed everything from Grouping and Sorting and now ORDER BY in my SELECT query is working as it should. ...
    (microsoft.public.access.modulesdaovba)
  • Re: Sorting by complex alphanumeric data
    ... sort as though it were a true Year. ... I didn't know that you could write statements into the sorting and grouping ... most likely could use in the Report Sorting & Grouping what I gave you above ... The first one characters are always letters. ...
    (microsoft.public.access.reports)