Hale, Jim
Jim.Hale at FleetPride.com
Fri Dec 7 11:23:24 CST 2007
Neat
Jim Hale
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Arthur Fuller
Sent: Friday, December 07, 2007 10:35 AM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] events question
I think the previous explanation is appropriate. I use that approach
often.
For example, in a continuous form I define double-click as Sort, and
another
double-click as Sort Descending. I have a function just as outlined
previously (in my case called SortByColumn()), and in the double-click
property I just type this:
<code>
=SortByColumn([Form])
</code>
In case anyone's interested, the code for said function is:
<code>
Public Function SortByColumn(f As Form)
Dim ctlCurrentControl As Control
Dim strControlName As String
Set ctlCurrentControl = Screen.ActiveControl
strControlName = ctlCurrentControl.Name
Debug.Print strControlName
Debug.Print f.OrderBy
'08-Sep-01
'line changed to support subform invocation
'ActiveForm refers to the master form, not the subform
' If Screen.ActiveForm.OrderBy = vbNullString Then
If f.OrderBy = vbNullString Then
DoCmd.RunCommand acCmdSortAscending
' ElseIf Right(Screen.ActiveForm.OrderBy, 4) = "Desc" Then
ElseIf Right(f.OrderBy, 4) = "Desc" Then
DoCmd.RunCommand acCmdSortAscending
Else
DoCmd.RunCommand acCmdSortDescending
End If
Set ctlCurrentControl = Nothing
'DoCmd.RunCommand acCmdSortAscending 'or Descending
End Function
</code>
hth,
Arthur
***********************************************************************
The information transmitted is intended solely for the individual or
entity to which it is addressed and may contain confidential and/or
privileged material. Any review, retransmission, dissemination or
other use of or taking action in reliance upon this information by
persons or entities other than the intended recipient is prohibited.
If you have received this email in error please contact the sender and
delete the material from any computer. As a recipient of this email,
you are responsible for screening its contents and the contents of any
attachments for the presence of viruses. No liability is accepted for
any damages caused by any virus transmitted by this email.