johannaellamay
Registered User.
- Local time
- Tomorrow, 06:11
- Joined
- Jul 19, 2014
- Messages
- 190
Hi! I have a problem with my code. I'm trying to sort and filter a continuous form. Sort ascending and filters works perfectly fine. But my descending button doesn't work. I basically have a combo box which contains a field list. Then two buttons (asc. and desc.), then a text box for filter, a button to filter, and another button to reset filter. Here's my code:
What am I doing wrong?
Code:
Private Sub cmdAscending_Click()
If IsNull(Me.cboField) Then
MsgBox "Please choose a field.", vbOKOnly, "No field to sort."
Else
Me.OrderBy = Me.cboField
Me.OrderByOn = True
End If
End Sub
Private Sub cmdDescending_Click()
If IsNull(Me.cboField) Then
MsgBox "Please choose a field.", vbOKOnly, "No field to sort."
Else
Me.OrderBy = Me.cboField
Me.OrderByOn = False
End If
End Sub
Private Sub cmdFilter_Click()
If IsNull(Me.cboField) Then
MsgBox "Please choose a field.", vbOKOnly, "No field to sort."
Else
If IsNull(Me.txtFilter) Then
MsgBox "Please type a text to filter.", vbOKOnly, "No text to filter."
Else
Me.Filter = "[" & [cboField] & "] Like '" & [txtFilter] & "*'"
Me.FilterOn = True
End If
End If
End Sub
What am I doing wrong?