Hi there!
I have a listbox, (which grabs its data from a stored query) that can be sorted by the user using buttons on the form - eg i have a button which allows the user to sort listbox results by ascending price.
There is also a button which lets you print a report, which is generated containing the results of the original query.
However when the items are re-sorted by the user, according to (continuing with the example) ascending price, a new query is created on the fly in the onclick event for the button, using code such as:
Me.MyListBox.RowSource = "Select Field2, Field1 From SomeTable Order By Field2 Asc"
Me.MyListBox.Requery
The Report, however, doesn't know anything about this new resorted/reordered information, and so just prints in according to however it is stored in the original query?
Basic question is - i want to let the user print a report with the records viewed as they last sorted them in the listbox - how can i make and print a report which is generated using whatever query the listbox has? How can i change the record source to the latest query from the listbox?
I hope this is clear - i've been awake quite a long time now!
Thanks
Edd
I have a listbox, (which grabs its data from a stored query) that can be sorted by the user using buttons on the form - eg i have a button which allows the user to sort listbox results by ascending price.
There is also a button which lets you print a report, which is generated containing the results of the original query.
However when the items are re-sorted by the user, according to (continuing with the example) ascending price, a new query is created on the fly in the onclick event for the button, using code such as:
Me.MyListBox.RowSource = "Select Field2, Field1 From SomeTable Order By Field2 Asc"
Me.MyListBox.Requery
The Report, however, doesn't know anything about this new resorted/reordered information, and so just prints in according to however it is stored in the original query?
Basic question is - i want to let the user print a report with the records viewed as they last sorted them in the listbox - how can i make and print a report which is generated using whatever query the listbox has? How can i change the record source to the latest query from the listbox?
I hope this is clear - i've been awake quite a long time now!
Thanks
Edd