If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Returning a reference to a control in a form to a query
This is my situation:
I have a form that I might use in more than one place, so I don't want to use a fully qualified reference to a control on it within queries on the form. Also, it is fairly deep in the structure and I've never found referencing a control on a deeply nested subform intuitive. So what I want to do is have a function that simply returns something like Me.Control1.Value. The problem is, if I put that function on the form's module where it will know about "Me", it isn't recognized by the query. What's the best way to handle this? Thanks; Amy |
#2
|
|||
|
|||
Returning a reference to a control in a form to a query
I would use functions to do the work. You can pass the form and control
names to the function and build the SQL there. -- Dave Hargis, Microsoft Access MVP "Amy Blankenship" wrote: This is my situation: I have a form that I might use in more than one place, so I don't want to use a fully qualified reference to a control on it within queries on the form. Also, it is fairly deep in the structure and I've never found referencing a control on a deeply nested subform intuitive. So what I want to do is have a function that simply returns something like Me.Control1.Value. The problem is, if I put that function on the form's module where it will know about "Me", it isn't recognized by the query. What's the best way to handle this? Thanks; Amy |
#3
|
|||
|
|||
Returning a reference to a control in a form to a query
What format would I need to give back to the combobox for it to be able to
use it as a RowSource? And, would the function both be able to get access to the properties of "Me" and be accessible to the RowSource? Additionally, I have many queries in several places that need to do this... reconstructing all the SQL in different functions seems inefficient. Thanks; Amy "Klatuu" wrote in message ... I would use functions to do the work. You can pass the form and control names to the function and build the SQL there. -- Dave Hargis, Microsoft Access MVP "Amy Blankenship" wrote: This is my situation: I have a form that I might use in more than one place, so I don't want to use a fully qualified reference to a control on it within queries on the form. Also, it is fairly deep in the structure and I've never found referencing a control on a deeply nested subform intuitive. So what I want to do is have a function that simply returns something like Me.Control1.Value. The problem is, if I put that function on the form's module where it will know about "Me", it isn't recognized by the query. What's the best way to handle this? Thanks; Amy |
Thread Tools | |
Display Modes | |
|
|