Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Use command button to sort records on a form

4 views
Skip to first unread message

paulevans82

unread,
Jun 24, 2008, 11:47:00 PM6/24/08
to
I have a form frmProgramEnrol based on qryProgramEnrol which displays
enrolments in a professional development course.

I would like to use command buttons in the footer to sort the records (I
will have three buttons, Sort by Name, Sort by Date, Sort by Status).

I used the following code:

Private Sub cmdSortName_Click()
Me.OrderBy = "[Person]"
Me.OrderByOn = True
End Sub

But when I click the button, I get the message
"The expression On Click you entered as the event property setting produced
the following error: Invalid outside procedure".

I'm pretty sure I'm missing something quite straightforward here. I would
appreciate your help

paulevans82

unread,
Jun 25, 2008, 12:14:00 AM6/25/08
to
OK I fixed it - it wasn't a problem with what I was trying to do, it was that
I had a stray line of code elsewhere in the database

Wayne-I-M

unread,
Jun 25, 2008, 3:15:00 AM6/25/08
to
Hi

Another way of doing this and you can use it on all the control on a
continous form would be to add a label for each "column" (control) on the
form.
So If you had controls with 1st name 2ndname dateofbirth etc
you would add a lable to the form header above each column

Put this on click of each label

Private Sub LabelName_Click()
Me.OrderBy = "[ControlName]"


Me.OrderByOn = True
End Sub

Change the LableName and ControlName to what the really are

Users like these as they are easy to understand and I use them as they
remove the need to add another button to a form - I try to keep the forms
un-cluttered


--
Wayne
Manchester, England.

0 new messages