Dynamcially change sort order on continuous form

D

Dennis

Hi,

I’m using Access via XP Office with Office XP3. I’ve looked through the
forum and while I saw similar, I did not see the answer to this question.

I want to create a continuous form that will display the results of a query.
I want the user to be able to click on the heading to change the sort order
of the query.

I noticed that the labels do not have any events, so I am guessing that I
will have to make the column heading text boxes so I can have a click event.
Is that correct? I’m also guessing that I’ll have to disable those text
boxes? If I do that, will the click event still work?

I realize that once a user clicks on a column heading, I will have to
programmatically change the Form’s Order By property.

Am I headed in the right direction or is there an easier way to accomplish
this?

Thanks,


Dennis
 
A

Allen Browne

Unattached labels do have a Click event, so you can use that if you use
unattached labels (in the Form Header section of your continuous form.)

Use the event to set the form's OrderBy property (remembering to set
OrderByOn as well.)
 
T

tighe

Dennis,

Personally i would use buttons instead of text boxes, the formatting can be
changed to resemble labels. i have only done this in reports but it should be
similar in forms, the on click event:

Private Sub Command29_Click()
Me.OrderBy = ""
Me.OrderBy = "Criteria"
End Sub

hope this helps.
 
D

Dennis

tighe,

I wanted to go with buttons, but I could not figure out how to change the
formatting to make it look like a label. How do you change the formatting to
look like a label?

I do not use a Picture and if I change the Transparent property to True, the
button disappears. It is true I can put a transparent button over each
label, but I was hoping for a simpler approach.

Thanks.

Dennis
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top