Howto bind a textbox to a table field

  • Thread starter Thread starter news
  • Start date Start date
N

news

Hallo

My form is linked to table A.
All textboxes are linked to fields of table A, but
in one I want to have the contents of another table.
For this field I dispose of a key that can be used to search
table B and retrieve a field from there. Then I want
to put the field value in the textbox.
I have no idea how to arrange this, can somone help me ?
 
Sounds like you want to use DLookup which you should lookup
in Help. You will end up with something like this as the
ControlSource for your field...

=DLookup("[DesiredInfo]", "[SearchTable]","[CriteriaField] =
'" & Me!SearchCriteriaField & "'")

Gary Miller
Sisters, OR
 
First thank you for the attention Gary,

I had no success in applying the DLookup() as Control Source value.It
didn't work. I got a display of '#NAME' in the textbox.
I read the docs, but that said it should work...

But I want to know how to use the DLookup function. So I describe now
more precisely what I'm doing.

I have a form linked to table [suppliers]
Then there is a button, labeled 'products', in the event of which I open
another form linked to table [products] - (As filter I pass the supplier_id)

Now a form with products for a particular supplier shows up.
In this form I had originally a combobox with 'Control Souurce' =
supplier_id and 'Row Source' = select supplier_name from [suppliers]
where [products].[supplier_id] = [suppliers].[supplier_id].

Because I didn't want the supplier to be changed in the products form,
I changed the combobox to a textbox. But the textbox has no means of
executing a query like the combo.
Then I asked for help soving this, and you generously suggested : DLookup.
With the Expression Builder I inserted DLookup in the Control Source and
set the parameters : Control Source
=DLookup([supplier_name],[suppliers],[suppliers]![supplier_id]=5)
On purpose I set the supplier_id to a hardcoded 5, just for testing.
Later this will be a parameter.

So, if you want to help me with this, I would be very obliged,

Harry


Gary said:
Sounds like you want to use DLookup which you should lookup
in Help. You will end up with something like this as the
ControlSource for your field...

=DLookup("[DesiredInfo]", "[SearchTable]","[CriteriaField] =
'" & Me!SearchCriteriaField & "'")

Gary Miller
Sisters, OR

Hallo

My form is linked to table A.
All textboxes are linked to fields of table A, but
in one I want to have the contents of another table.
For this field I dispose of a key that can be used to
search

table B and retrieve a field from there. Then I want
to put the field value in the textbox.
I have no idea how to arrange this, can somone help me ?
 
Back
Top