Re: "Sort" a combination of letters and numbers e.g. 20, 21a,200,
- From: "Crazy Lady" <CrazyLady@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 29 Sep 2005 04:51:04 -0700
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
>
.
- Prev by Date: Re: Report Page size (8 1/2 x 14)
- Next by Date: Re: "Sort" a combination of letters and numbers e.g. 20, 21a,200,
- Previous by thread: Re: Report Page size (8 1/2 x 14)
- Next by thread: Re: "Sort" a combination of letters and numbers e.g. 20, 21a,200,
- Index(es):
Relevant Pages
|