I currently have a basic query that uses a form field. This query is used as the row source for a listbox that has a lot of events associated with it.
SELECT *
FROM ITEMS
WHERE ITEMS.ITEM_ID = Forms![Form 1]!ItemID
How can I change this query to work in more than one form, not just Form 1? Is there a way I can reference the active form or the form from where the query is called e.g. WHERE ITEMS.ITEM_ID = Forms![Active Form]!ItemID (assuming all forms have an 'ItemID' field)
More specifically I want to do this:
In Form 1 my listbox rows are the result of the query. When I select a record, some function is called via Before Update.
In Form 2 I want to use the query results in a listbox, only selecting a result performs a different function in that form on some other event.
In Form 3 perhaps the same query can be used to simply display all the records for editing.
None of the forms are linked to any tables and I don't want to use subforms. The only solution I can think of is to make many copies of the query and specify the form to use in each one, but where's the fun in that.
SELECT *
FROM ITEMS
WHERE ITEMS.ITEM_ID = Forms![Form 1]!ItemID
How can I change this query to work in more than one form, not just Form 1? Is there a way I can reference the active form or the form from where the query is called e.g. WHERE ITEMS.ITEM_ID = Forms![Active Form]!ItemID (assuming all forms have an 'ItemID' field)
More specifically I want to do this:
In Form 1 my listbox rows are the result of the query. When I select a record, some function is called via Before Update.
In Form 2 I want to use the query results in a listbox, only selecting a result performs a different function in that form on some other event.
In Form 3 perhaps the same query can be used to simply display all the records for editing.
None of the forms are linked to any tables and I don't want to use subforms. The only solution I can think of is to make many copies of the query and specify the form to use in each one, but where's the fun in that.