A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

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



 
 
Thread Tools Display Modes
  #1  
Old January 9th, 2008, 08:19 PM posted to microsoft.public.access.forms
Amy Blankenship
external usenet poster
 
Posts: 539
Default 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  
Old January 9th, 2008, 10:00 PM posted to microsoft.public.access.forms
Klatuu
external usenet poster
 
Posts: 7,074
Default 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  
Old January 9th, 2008, 10:40 PM posted to microsoft.public.access.forms
Amy Blankenship
external usenet poster
 
Posts: 539
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 07:24 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.