I have a continuous form where the user can change what is displayed on it by selecting a date in a combo box in the header area.
Then, they can sort the records by clicking a couple of the text labels in the header section. One of the ones they can click is called Over/Under.
Here's the code that is tied to the On Click event of that text label.
It works correctly sometimes, but not others.
Here's a screenshot from when it is working correctly.
This is correct, because it is sorting the numbers in the column by highest to lowest.
But when I change the selection in the Date combo box and then click Over/Under, it does the sort but not correctly. Here's a screenshot.
I experimented and found that if I removed the "DESC" from the line of code in the On Click sub, here is how it sorts the two examples above.
Now the latter one is correct (almost), but the former is wrong.
I don't understand why it is doing this.
Another related question: I would like any record where Over/Under is either Null or doesn't contain a number to be at the bottom of the sort. Ones with numbers should always come first. In some instances, it seems like that is happening (at least when it comes to a Null value) but other times it is not.
Then, they can sort the records by clicking a couple of the text labels in the header section. One of the ones they can click is called Over/Under.
Here's the code that is tied to the On Click event of that text label.
Code:
Private Sub OverUnder_Label_Click()
'This will sort the results by OverUnder.
Me.OrderBy = "OverUnder DESC"
Me.OrderByOn = True
Me.Refresh
End Sub
It works correctly sometimes, but not others.
Here's a screenshot from when it is working correctly.
This is correct, because it is sorting the numbers in the column by highest to lowest.
But when I change the selection in the Date combo box and then click Over/Under, it does the sort but not correctly. Here's a screenshot.
I experimented and found that if I removed the "DESC" from the line of code in the On Click sub, here is how it sorts the two examples above.
Now the latter one is correct (almost), but the former is wrong.
I don't understand why it is doing this.
Another related question: I would like any record where Over/Under is either Null or doesn't contain a number to be at the bottom of the sort. Ones with numbers should always come first. In some instances, it seems like that is happening (at least when it comes to a Null value) but other times it is not.