Andrew
I do that by placing a small label on top of the header label. I set the font for the small label to wingdings and use Chr(217) for ascending and Chr(218) for descending.
I just wrote a routine for this last month. Here it is.
Private Sub pSortOrder(ctrl As Control)
'Purpose : Change how form is sorted.
'DateTime : 5/28/2013 09:42
'Author : Bill Mosca
'Requires :
Dim ct As Control
Dim strSortBy As String
Dim strSortDir As String
If gbolErrorTrapOff = False Then On Error GoTo err_PROC
Select Case ctrl.Caption
Case Chr(218), "" 'Descending/no sort
'Toggle to Ascend
ctrl.Caption = Chr(217)
strSortDir = ""
Case Chr(217) 'Ascending
'Toggle to Descend
ctrl.Caption = Chr(218)
strSortDir = "DESC"
End Select
'Requires special handling if Milestone Category
If ctrl.Name = "lblMilestoneCatID" Then
strSortBy = "tblMileStoneCategories_lkp.SortOrder" _
& " " & strSortDir
Else
strSortBy = Mid(ctrl.Name, 4) & " " & strSortDir
End If
Me.OrderBy = strSortBy
Me.OrderByOn = True
For Each ct In Me.FormHeader.Controls
'Clear all other sorts
If ct.Tag = "Sort" And ct.Name <> ctrl.Name Then
ct.Caption = ""
End If
Next
exit_PROC:
On Error Resume Next
Exit Sub
err_PROC:
Dim strErrMsg As String
Dim lngIcon As Long
Select Case Err.Number
Case 2501
'Open cancelled.
strErrMsg = "No information for selected filter."
lngIcon = vbOKOnly + vbInformation
Case Else
gProcName = "pSortOrder"
glngErrNum = Err.Number
gstrErrDescr = Err.Description
glngLineNum = Erl
Call ErrorLog("Form_frmMilestones_sub")
End Select
If strErrMsg <> "" Then MsgBox strErrMsg, lngIcon, _
GetSummaryInfo("Title", False)
Resume exit_PROC
End Sub
Regards,
Bill Mosca, Founder - MS_Access_Professionals
http://www.thatlldoit.com
Microsoft Office Access MVP
https://mvp.support.microsoft.com/profile=C4D9F5E7-BB03-4291-B816-64270730881E
My nothing-to-do-with-Access blog
http://wrmosca.wordpress.com
--- In MS_Access_Professionals@yahoogroups.com, adwsys <no_reply@...> wrote:
>
> Hi All,
>
> Does anyone know of a way of including extended ASCII characters in a form label in Access?
>
> I have a continuous form in which some of the column heading labels can be clicked to sort the records in the form by that column. What I want to do is when the user clicks on a label to sort the records, I want to change the label caption so that it contains an indicator that the form is sorted by that column. I'd thought of simply using the extended ASCII triangle characters (▲ & ▼) but I can't find a way of reproducing them on the label using VBA.
>
> Andrew
>
| Reply via web post | Reply to sender | Reply to group | Start a New Topic | Messages in this topic (2) |
Tidak ada komentar:
Posting Komentar