managnig nulls in combobox sort

J

johnlute

I have a combobox that displays 3 columns:
numID (PK) | txtCode | txtDescription

Records may or may not have a txtCode. I'd like to sort txtCode by
Ascending order however this places nulls first.

Is there a way to make the nulls list AFTER? I know this defies the
logic of Ascending order but it would be helpful in this particular
scenario.

Thanks!
 
J

johnlute

Wow, Bruce! Thanks! That did the trick!

You could use the Nz function to substitute a value for null.  For instance,
if txtCode is letters:

txtCodeSort: Nz([txtCode],"zzz")

If txtCode needs to be seen in the drop-down list you can keep the existing
row source, but add a sort:

SELECT numID, txtCode, txtDescription
FROM Table1
ORDER BY Nz([txtCode],"zzz")
I have a combobox that displays 3 columns:
numID (PK) | txtCode | txtDescription
Records may or may not have a txtCode. I'd like to sort txtCode by
Ascending order however this places nulls first.
Is there a way to make the nulls list AFTER? I know this defies the
logic of Ascending order but it would be helpful in this particular
scenario.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top