If you simply want to include the value of the control in a column returned
by the query then put a fully qualified reference to the control in the
'field' row of a blank column in the query design grid. Precede this by the
name you want the column returned as and a colon, e.g.
MyField:Forms![Form 1]![Text 1]
The form has to be open when the query is opened and the query will need to
include at least one table which contains at least one row. If you wanted
the query to return only one row with just the one column then you can use
the DISTINCT option and any table, e.g. in SQL View:
SELECT DISTINCT Forms![Form 1]![Text 1] AS [MyField]
FROM [MyTable];
However, doing that would not make a lot of sense as you can directly
reference the control in the same way e.g. as the ControlSource of a control
on another form or in a report, or in VBA code.
Ken Sheridan
Stafford, England
Many thanks for all those examples.
In my case, the data is held on one particular form which is a job record,
and then I have another (completely unrelated) form onto which I want to pull
various bits of data.
I will want to use this particular value in a number of other areas too, so
I thought it best to use a query to pull it from the original form and then I
can re-use it wherever I need to.
CW
I did a lot of research on this last week in this usenet group, so I
thought I'd give back. Hope this example will be useful:
[quoted text clipped - 33 lines]
I do that when I open the form so that I'm sure that the GPM_Grouptxt
has a value.