I have a method I've been using to sort my forms, and it works well... but I'm having an error with one field so I'm not sure what I'm doing wrong...
The sorting code I'm using is:
Code:
Private Sub Toggle_Sort(sColumn As String)
Me.Controls(sColumn).SetFocus
If TempVars!varAcctSort = "Ascending" Then
DoCmd.RunCommand acCmdSortAscending
TempVars!varAcctSort = "Descending"
Else
DoCmd.RunCommand acCmdSortDescending
TempVars!varAcctSort = "Ascending"
End If
End Sub
Then I call it with the click event of the label for the columns like this:
Code:
Private Sub lblFName_Click()
Toggle_Sort ("txtFName")
End Sub
Private Sub lblLName_Click()
Toggle_Sort ("txtLName")
End Sub
I have a form with this code and all fields work EXCEPT for a text field containing email addresses... Whenever I attempt to click the email address label, I get a runtime error:
Code:
Run-time error '2046':
The command or action 'SortAscending' isn't available now.
It's only on that field... the only difference I can see between that field and any other is that its "Is Hyperlink" is set to yes, and that it contains email addresses....
Any ideas of what might be the issue?