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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

OrderBy - show NULL value at the end

Status
Not open for further replies.

tobymom

Programmer
Aug 18, 2006
36
US
Dear Experts,

I have a field which has some NULL values. When I sort this field ASC, (Let's say "fldA"), NULL values show up at the top.

I understand I can make them listed at the bottom by using query - fldA Is Null DESC, fldA ASC.

Is there anyway to do this by using Form's "OrderBy" property?

I tried this VBA but didn't work.

Form.OrderBy = "fldA Is Null DESC, fldA ASC"
Form.OrderbyOn = TRUE

Any advise will be appreciated.

Thank you.
 
How are ya tobymom . . .

For starters, the [blue]Order By[/BLUE] property doesn't accept a condition [blue]"[purple]fldA Is Null[/purple] DESC, fldA ASC"
[/blue]. It only accepts a [blue]fieldName[/blue] and [blue]ASC or DESC[/blue]. [purple]fldA Is Null[/purple] should be part of criteria used in the query or SQL of the [blue]RecordSource[/blue] of the form.

All you should need for the [blue]Order By[/blue] property is:
Code:
[blue]   Me!OrderBy = "fldA DESC"
   Me.OrderByOn = True[/blue]
[blue]Your Thoughts? . . .[/blue]"


See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
What about this ?
Code:
Form.OrderBy = "Nz(fldA,Chr(255))"

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top