INeedAccessHelp
MIS
Hi
Here is the function:
Public Function SortByTag(ctlCurrent As Control, frmCurrent As Form)
Dim SortOrd, FormName As String
SortOrd = ctlCurrent.Tag
If ctlCurrent.Tag = frmCurrent.OrderBy Then
frmCurrent.OrderBy = SortOrd & " DESC"
frmCurrent.OrderByOn = True
Else
frmCurrent.OrderBy = SortOrd
frmCurrent.OrderByOn = True
End If
End Function
Here is the Control Source of the field (Complete Date) attempted to be sorted:
=Nz(DLookUp("CompletionDate","CompletionInfo","RequestID= " & [Forms]![LookupReqFRM]![LookupRequests subform]![RequestID]))
The name of the command button to sort this field is "Complete Date". Here is the "On Click" expression:
=SortByTag([Complete Date],[Forms]![LookupReqFRM]![LookupRequests subform].[Form])
My question is, what should I set the "Tag" property to for this command button to work properly? The other (working) command buttons that perform this function use the "Control Source" of the field being sorted in it's "Tag" property.
Because the "Control Source" for this field is unusual, I cannot get the sort to work. Any ideas?
Here is the function:
Public Function SortByTag(ctlCurrent As Control, frmCurrent As Form)
Dim SortOrd, FormName As String
SortOrd = ctlCurrent.Tag
If ctlCurrent.Tag = frmCurrent.OrderBy Then
frmCurrent.OrderBy = SortOrd & " DESC"
frmCurrent.OrderByOn = True
Else
frmCurrent.OrderBy = SortOrd
frmCurrent.OrderByOn = True
End If
End Function
Here is the Control Source of the field (Complete Date) attempted to be sorted:
=Nz(DLookUp("CompletionDate","CompletionInfo","RequestID= " & [Forms]![LookupReqFRM]![LookupRequests subform]![RequestID]))
The name of the command button to sort this field is "Complete Date". Here is the "On Click" expression:
=SortByTag([Complete Date],[Forms]![LookupReqFRM]![LookupRequests subform].[Form])
My question is, what should I set the "Tag" property to for this command button to work properly? The other (working) command buttons that perform this function use the "Control Source" of the field being sorted in it's "Tag" property.
Because the "Control Source" for this field is unusual, I cannot get the sort to work. Any ideas?