Calculated controls - sorting (2007)

Egg 'n' Bacon
5StarLounger
Posts: 736
Joined: 18 Mar 2010, 11:05

Calculated controls - sorting (2007)

Post by Egg 'n' Bacon »

OK, here's the next one :)

I have a form based on a table with a couple of text boxes that are populated with calculations from other fields (i.e. TxtTgtClosure equals [DateRaised]+5).

On request, I have put ASC & DESC sort buttons for each field, but those for the calculated controls do not work.

Here's an example of the code I'm using;

Code: Select all

    Me.OrderByOn = False
    Me.OrderBy = "TxtTgtClose"
    Me.OrderByOn = True
BTW, both calculated controls are based on Date fields

Egg 'n' Bacon
5StarLounger
Posts: 736
Joined: 18 Mar 2010, 11:05

Re: Calculated controls - sorting (2007)

Post by Egg 'n' Bacon »

Ah, sorted it; I needed to base the form on a query with the calculations in that.

User avatar
HansV
Administrator
Posts: 78488
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Calculated controls - sorting (2007)

Post by HansV »

Yep - you can't sort on a calculated control, but you can sort on a calculated field from the record source.
Best wishes,
Hans