Advertisement

06.29.2005 at 07:34AM PDT, ID: 21474844
[x]
Attachment Details

Sorting a datasheet subform

Asked by imsmis in Microsoft Access Database

Tags: subform, access, sort

I have a main form with a datasheet subform that is a reflection of a large table.  I would like to sort the fields based on a user's field selection from a combo box.  The layout is such:  My main form, with the subform in it, a combo box and a button at the bottom of the main form.  When the user selects a field name from the combo box and hits the button, the subform will sort accordingly.  So far, I've been able to sort it ascending (default), but not descending.  Here is my code:

Private Sub Command17_Click()
 
    Me![HPK_Providers subform].Form.OrderByOn = True    
    Me![HPK_Providers subform].Form.OrderBy = Combo30
   
End Sub

Easy code, and it works like a charm for sorting ascending, but how can I make this sort descending?
Note:  I've tried quotes (i.e. *.orderby = "[Combo30] desc") and brackets and all sorts of things.  Also using Access 2K3.Start Free Trial
[+][-]06.29.2005 at 07:36AM PDT, ID: 14328959

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.29.2005 at 07:40AM PDT, ID: 14329006

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.29.2005 at 07:43AM PDT, ID: 14329044

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.29.2005 at 07:45AM PDT, ID: 14329065

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Microsoft Access Database
Tags: subform, access, sort
Sign Up Now!
Solution Provided By: jet46
Participating Experts: 2
Solution Grade: A
 
 
[+][-]06.29.2005 at 07:48AM PDT, ID: 14329125

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.29.2005 at 07:52AM PDT, ID: 14329169

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.29.2005 at 07:53AM PDT, ID: 14329181

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.29.2005 at 07:54AM PDT, ID: 14329205

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32