Returning a reference to a control in a form to a query

  • Thread starter Amy Blankenship
  • Start date
A

Amy Blankenship

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
 
K

Klatuu

I would use functions to do the work. You can pass the form and control
names to the function and build the SQL there.
 
A

Amy Blankenship

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top