Sorting Records using the Double click event

  • Thread starter Thread starter Les
  • Start date Start date
L

Les

I know this should be simple but can't seem to get it to work.

I have 2 fields in a form "Surname" & "FirstName" all I want to do is use
the sort on either field if I double click that particular field. I have
tried using the runCommand record sort but get a Varible not defined error.

Thanks

Les
 
Give this a try in the On Dbl Click event of the Surname field:

If Me.OrderBy = "Surname DESC" Then
Me.OrderBy = "Surname"
Else
Me.OrderBy = "Surname DESC"
End If
Me.OrderByOn = True

You can use the same code in the On Dbl Click event of the FirstName field,
just change the field name.

--
HTH

Mr B
email if needed to:
draccess at askdoctoraccess dot com
 
Les,

I should have mentioned that the code I posted will first sort by the field
name in ascending order. The second time you double click, it will sort on
that field in descending order.
--
HTH

Mr B
email if needed to:
draccess at askdoctoraccess dot com
 
Thanks that works fine

Les


Mr B said:
Les,

I should have mentioned that the code I posted will first sort by the
field
name in ascending order. The second time you double click, it will sort
on
that field in descending order.
--
HTH

Mr B
email if needed to:
draccess at askdoctoraccess dot com
 
Back
Top