Sorting a Form

mavver

Registered User.
Local time
Today, 16:13
Joined
Jan 12, 2007
Messages
28
Hello All

I have a form based on a table which is currently sorting itself by an alphanumeric text field called "Query_Code".

The sorting order is currently in ascending order, thus it sorts empty data points then by the "Query_Code"

eg

[Empty]
[Empty]
[Empty]
[Empty]
QU000001
QU000002
QU000005
QU000123

When I assign a "Query_Code" to a record it automatically resorts it.

However, what I actually want is to sort the Records as follows

QU000001
QU000002
QU000005
QU000123
[Empty]
[Empty]
[Empty]
[Empty]

I thought an Me.OrderBy function but I couldn't get my head round it. Since if I sorted the records in descending order it would be

QU000123
QU000005
QU000002
QU000001
[Empty]
[Empty]
[Empty]
[Empty]

Hope someone can help

Thanks in advance

Mav
 
If you sort by that field, it will always have the empty ones on top if sorted ascending and at the bottom when sorting descending. However, you can't just have the ones with values sort ascending and have the empty ones at the bottom. The sort, just won't work that way.

Now, here's what you can do. You can add a field to your query to sort on

SortFields:IIf(IsNull([QueryCode]) Or [QueryCode]="",2,1)

and in the sort, set it to Ascending.
 

Users who are viewing this thread

Back
Top Bottom