Sort in ListView control (1 Viewer)

danikuper

Registered User.
Local time
Today, 09:23
Joined
Feb 6, 2003
Messages
147
Hi All,

Couldn't find an answer for this one...

I have a listview control in a form that is being populated from a query. I would like to give the user the option of clicking on column headers to sort the contents of the listview.

Is there a way to do this? I know there's a sort property I could use but I'm not sure how. Any help is greatly appreciated!!!

Thanks.
Daniel
 

danikuper

Registered User.
Local time
Today, 09:23
Joined
Feb 6, 2003
Messages
147
Forget about it! Just got the answer by searching on another forum. For those intersted on how to do that, here goes the code:

Private Sub ListView_ColumnClick(ByVal ColumnHeader As Object)
' When a ColumnHeader object is clicked, the ListView control is
' sorted by the subitems of that column.
' Set the SortKey to the Index of the ColumnHeader - 1
Activity_ListView.SortKey = ColumnHeader.Index - 1
' Set Sorted to True to sort the list.
Activity_ListView.Sorted = True

End Sub

Cheers!
:)
 
J

JA67

Guest
Please help me with listview sorting.

Hello,

I am new to this forum. I have a MS ListView control ver 6.0 in my MS Access 2003 form, and I want to have it sort by clicking on the column headers. I have found the code that Danikuper posted on a lot of different web sites, but I have not been able to implement it. It's probably just something simple, but I have wore myself out trying to make it work. :( I apparently do not know how to properly reference this code. I am missing something.

When I apply the code I get the following error:

"The expression On Click you entered as the event property setting produced the following error: Procedure declaration does not match description of event or procedure having the same name."

I get this error for almost anything I click on or do. Even when what I am clicking on does not have the code for its click event... I don't understand what is happening.

I would be endebted if you would please help me to get this working.

Thank You! :)
JA67
 
Last edited:

danikuper

Registered User.
Local time
Today, 09:23
Joined
Feb 6, 2003
Messages
147
Can you post the code you are using? It's been a while since I last messed around with it but we might be able to spot what is causing the error.

thanks.
daniel
 

Users who are viewing this thread

Top Bottom