468,772 Members | 1,848 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,772 developers. It's quick & easy.

Continuous forms - place lookup value in unbound textbox

How is the result of query placed in a unbound textbox ?

Suppose
CriteriaLookups has columns TableName, KeyColumn, KeyValue,
DataColumn

Foo,x,11,xhat
Bar,z,3,xyzzy

And

Lookup
Foo has columns x,xhat
Bar has columns z xyzzy

Foo data
....
11,123
....

Bar data
....
3,321
....

In a continuous form with .data=CriteriaLookups, want to show

lookup(unbound), TableName, KeyColumn, KeyValue, DataColumn

where the lookup control gets the result of the dynamic query
select ![DataColumn] from ![TableName] where ![KeyColumn]=!
[KeyValue]

form to show:
123,foo,x,11,xhat
321,bar,3,321,xyzzy
Is such a form plausible ?

Feb 12 '07 #1
3 10753
On Feb 12, 9:39 am, "Richard" <richard.goo...@devenezia.comwrote:
How is the result of query placed in a unbound textbox ?

Suppose
CriteriaLookups has columns TableName, KeyColumn, KeyValue,
DataColumn

Foo,x,11,xhat
Bar,z,3,xyzzy

And

Lookup
Foo has columns x,xhat
Bar has columns z xyzzy

Foo data
...
11,123
...

Bar data
...
3,321
...

In a continuous form with .data=CriteriaLookups, want to show

lookup(unbound), TableName, KeyColumn, KeyValue, DataColumn

where the lookup control gets the result of the dynamic query
select ![DataColumn] from ![TableName] where ![KeyColumn]=!
[KeyValue]

form to show:
123,foo,x,11,xhat
321,bar,3,321,xyzzy

Is such a form plausible ?

I sorry, but your description of the problem is a little foo-bar-ed.
I'll answer what I can and maybe that will help clear up what you are
trying to do.
How is the result of query placed in a unbound textbox ?
A query does not return 'a' result, it returns a set of results which
may or may not contain any information. If you want an unbound control
to display a portion of that data, you have to put it there yourself.
This usually means referencing a property of another control or
supplying the value through code. If you want the value of a combobox
or of one of it's columns, you can set the ControlSource property of
the textbox to =ComboBoxName.Column(x). After the user selects
something in the combobox, whatever data is in column x will be
displayed in the textbox.

Feb 13 '07 #2
On Feb 12, 10:45 pm, "storrboy" <storr...@sympatico.cawrote:
I sorry, but your description of the problem is a little foo-bar-ed.
I'll answer what I can and maybe that will help clear up what you are
trying to do.
How is the result of query placed in a unbound textbox ?

A query does not return 'a' result, it returns a set of results which
may or may not contain any information.
Thanks Storry.

I muddled about the help file and found that setting ControlSource to
=DLookup (DataColumn, TableName, KeyColumn&"="&KeyValue)
would do it.

The help tips include:
"
- Although you can use the DLookup function to display a value from a
field in a foreign table, it may be more efficient to create a query
that contains the fields that you need from both tables and then to
base your form or report on that query.
- You can also use the Lookup Wizard to find values in a foreign
table.
"

Eventually went with a view

Feb 13 '07 #3
On Feb 13, 10:45 am, "Richard" <richard.goo...@devenezia.comwrote:
On Feb 12, 10:45 pm, "storrboy" <storr...@sympatico.cawrote:
I sorry, but your description of the problem is a little foo-bar-ed.
I'll answer what I can and maybe that will help clear up what you are
trying to do.
How is the result of query placed in a unbound textbox ?
A query does not return 'a' result, it returns a set of results which
may or may not contain any information.

Thanks Storry.

I muddled about the help file and found that setting ControlSource to
=DLookup (DataColumn, TableName, KeyColumn&"="&KeyValue)
would do it.

The help tips include:
"
- Although you can use the DLookup function to display a value from a
field in a foreign table, it may be more efficient to create a query
that contains the fields that you need from both tables and then to
base your form or report on that query.
- You can also use the Lookup Wizard to find values in a foreign
table.
"

Eventually went with a view

That will work too, but keep in mind that the domain functions can
slow things down as the database grows.
If you've already gathered the data once in another control, it is
faster to reference it instead of reading the table(s) multiple times.
In a small database though you probably wouldn't notice much.

Feb 13 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by panwala_bhavesh | last post: by
1 post views Thread by blueheelers | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.