Rakier
Registered User.
- Local time
- Today, 12:33
- Joined
- Mar 21, 2002
- Messages
- 75
I'm hoping someone can help me with this.
The short question:
How can I pass a variable from a form to a query that is used to populate a list box on the form?
The long version:
I have a form...we'll call it frmAlpha. On the form there is a list box, lstItems. There is a text box called strItemText. When you type a value in the text box, it requeries the listbox to show items that begin with those letters.
The query "qryHSItems" has the following criteria for the strItemName field.
Like [forms]![frmAlpha].[strItemText] & "*"
There is also some code on the form for the OnChange event of the text box.
This works great, however I am needing to build more forms that will have other names and I want to use the same query for all of these forms. Each of the forms is for different functions, but each needs to access the same information from this query.
Is there a way to pass the name of the form to the querie's criteria? I can copy the query and make a new one, replacing the form name with the appropriate name, however, I want to make as few queries as possible. I can't seem to get it to work.
The short question:
How can I pass a variable from a form to a query that is used to populate a list box on the form?
The long version:
I have a form...we'll call it frmAlpha. On the form there is a list box, lstItems. There is a text box called strItemText. When you type a value in the text box, it requeries the listbox to show items that begin with those letters.
The query "qryHSItems" has the following criteria for the strItemName field.
Like [forms]![frmAlpha].[strItemText] & "*"
There is also some code on the form for the OnChange event of the text box.
This works great, however I am needing to build more forms that will have other names and I want to use the same query for all of these forms. Each of the forms is for different functions, but each needs to access the same information from this query.
Is there a way to pass the name of the form to the querie's criteria? I can copy the query and make a new one, replacing the form name with the appropriate name, however, I want to make as few queries as possible. I can't seem to get it to work.