G
Guest
I have a list box with the following data source:
SELECT [lstItemsQuery].[ItemID], [lstItemsQuery].[ItemDate],
[lstItemsQuery].[ItemType], [lstItemsQuery].[ItemTitle],
[lstItemsQuery].[Archive?] FROM lstItemsQuery ORDER BY
[lstItemsQuery].[ItemDate], [lstItemsQuery].[ItemType],
[lstItemsQuery].[ItemTitle];
I.e., there is a query (lstItemsQuery) that acts as the row source for the
list box (which is called lstItems). The list box is found on an unbound form
that's acting as a switchboard.
I want to add a control button to the form that, when clicked, will toggle
the row source between including all items ([Archive?] = Yes OR No) and just
the current items ([Archive?] = No). I have a couple of ideas of where to
start, but they seem pretty unwieldy and I think there must be a better way.
I was thinking I could just do something like this:
If lstItems.RowSource = "SELECT [lstItemsQuery].[ItemID],
[lstItemsQuery].[ItemDate], [lstItemsQuery].[ItemType],
[lstItemsQuery].[ItemTitle], [lstItemsQuery].[Archive?] FROM lstItemsQuery
ORDER BY [lstItemsQuery].[ItemDate], [lstItemsQuery].[ItemType],
[lstItemsQuery].[ItemTitle];" Then
lstItems.RowSource = "SELECT [lstItemsQuery].[ItemID],
[lstItemsQuery].[ItemDate], [lstItemsQuery].[ItemType],
[lstItemsQuery].[ItemTitle], [lstItemsQuery].[Archive?] FROM lstItemsQuery
WHERE [lstItemsQuery].[Archive?] = False ORDER BY [lstItemsQuery].[ItemDate],
[lstItemsQuery].[ItemType], [lstItemsQuery].[ItemTitle];
....and then I'd have to repeat the whole thing for the reverse case. But
this seems ridiculous. Is there a better way?
Thanks,
Jen
SELECT [lstItemsQuery].[ItemID], [lstItemsQuery].[ItemDate],
[lstItemsQuery].[ItemType], [lstItemsQuery].[ItemTitle],
[lstItemsQuery].[Archive?] FROM lstItemsQuery ORDER BY
[lstItemsQuery].[ItemDate], [lstItemsQuery].[ItemType],
[lstItemsQuery].[ItemTitle];
I.e., there is a query (lstItemsQuery) that acts as the row source for the
list box (which is called lstItems). The list box is found on an unbound form
that's acting as a switchboard.
I want to add a control button to the form that, when clicked, will toggle
the row source between including all items ([Archive?] = Yes OR No) and just
the current items ([Archive?] = No). I have a couple of ideas of where to
start, but they seem pretty unwieldy and I think there must be a better way.
I was thinking I could just do something like this:
If lstItems.RowSource = "SELECT [lstItemsQuery].[ItemID],
[lstItemsQuery].[ItemDate], [lstItemsQuery].[ItemType],
[lstItemsQuery].[ItemTitle], [lstItemsQuery].[Archive?] FROM lstItemsQuery
ORDER BY [lstItemsQuery].[ItemDate], [lstItemsQuery].[ItemType],
[lstItemsQuery].[ItemTitle];" Then
lstItems.RowSource = "SELECT [lstItemsQuery].[ItemID],
[lstItemsQuery].[ItemDate], [lstItemsQuery].[ItemType],
[lstItemsQuery].[ItemTitle], [lstItemsQuery].[Archive?] FROM lstItemsQuery
WHERE [lstItemsQuery].[Archive?] = False ORDER BY [lstItemsQuery].[ItemDate],
[lstItemsQuery].[ItemType], [lstItemsQuery].[ItemTitle];
....and then I'd have to repeat the whole thing for the reverse case. But
this seems ridiculous. Is there a better way?
Thanks,
Jen