Results 1 to 5 of 5
  1. #1
    Silver Lounger GARYPSWANSON's Avatar
    Join Date
    Aug 2001
    Location
    Frederick, Maryland, USA
    Posts
    1,788
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Interactive / Sort on List Box (A2K SR1)

    A report has fields Field1, Field2, Field3, Field4, and Field5. Data for the report is is generated by Query DataForReport. The query and report are launched from Form1.

    The user wants the ability to sort the data in the report such that on Form1 they can select any order of Fields 1 through 5 and the report will sort the data accordingly.

    I can think of using a listbox and the user would double click on each field in the order of the sort to populate another listbox containing the data in the particular order. The second listbox would then be used to control the recordsource for the report. (This I can do no problem but I think it is clunky)

    However, Is it possible to do the following? Using a listbox, can the listbox be setup such that the user can click on a data item and then drag and drop it to the order they want it. For example, if the user selects Field 5 (last in the last) and drags and drops it to the position for Field 1, the listbox would then show the order as Field5, 1,2,3,4 instead of 1,2,3,4,5? If I can't do this with a listbox, any ideas? - This, I can't figure out how to do. Another option on this would be double click on a field to move it up one level but this requires too much double clicking.

    Any ideas? <img src=/S/shrug.gif border=0 alt=shrug width=39 height=15>
    Regards,

    Gary
    (It's been a while!)

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Interactive / Sort on List Box (A2K SR1)

    Access isn't very good at drag and drop. MSKB article ACC2000: How to Simulate Drag-And-Drop Capabilities describes a simple simulation (with a link to a downloadable demo database), and Peter's Software has a more sophisticated drag and drop tool (not free, but you can download a free demo)

  3. #3
    Silver Lounger GARYPSWANSON's Avatar
    Join Date
    Aug 2001
    Location
    Frederick, Maryland, USA
    Posts
    1,788
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Re: Interactive / Sort on List Box (A2K SR1)

    Hans,

    Thanks for the drag and drop link. However, this is to drag and drop between different controls. Any chance you have an ingenious idea for re-sorting the order on a single control based on user input. The ideal situation is to select an item in the list and then move it somewhere else in the list where you want it to be, i.e., drag and drop in the same control. (Of course this doesn't sound logical.)

    Could you upon dragging from a control, remove the piece of data from the control, and then drop it back in the control where you would want it to go. Just thinking out loud here.

    I am starting to think this may just be too much work to do and may go back to my "Clunky" solution which is the user double clicks on each item from a list in the order they want the sort. Upon each double click the item is moved to another list that is the sort order that is then used to sort the data for the report.

    Thanks for your help.
    Regards,

    Gary
    (It's been a while!)

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Interactive / Sort on List Box (A2K SR1)

    If I remember correctly, the demo from PetersSoftware also contains examples of reordering a list box by dragging items, so it must be possible.

    Another way would be to put two command buttons next to the list box, with an up arrow and a down arrow. Clicking an item in the list box, then clicking the up or down button would move the item up or down (you need a dedicated sorting field for this; you would execute some code to update this field, then requery the list box.)

  5. #5
    Silver Lounger GARYPSWANSON's Avatar
    Join Date
    Aug 2001
    Location
    Frederick, Maryland, USA
    Posts
    1,788
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Re: Interactive / Sort on List Box (A2K SR1)

    Thanks Hans.

    Using an up and down arrow is exactly what I did. Pressing on the up arrow moves the selection in the Listbox upwards and pressing the down arrow, downwards.
    Regards,

    Gary
    (It's been a while!)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •