Output query data to a field in a form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello, I have a form that holds a drop down box. When I pick an item from
that drop down box it calls a query that looks into another table and outputs
a text value. How do I assign that text value to a text box in my original
form?

original table ==>Cause&Effect_tbl has two fields drop down [Cause] and a
text field called [Effect].
drop down combo box pulls the data from the following table:
Cause=Effect_tble holds two fields [Cause] and [Effect]

Query compares the [Cause] and returns the [Effect]

Hope this is enough info.
Thank you,
Vadimbar
 
You could set the controlsource of the textbox to the following :
=Dlookup("Result"."OtherTable","Cause='" & [comboboxName] & "'")
Result : Resultfield which you want to get fom othertable
OtherTable : is the name of the othertable
Cause is the field you are going to use to match with the value of the
combobox
Comboboxname : should be the name that you have given to your combobox

pay attention to the single quotes, you can leave them out if you are only
using numbers.

If the textbox should be editable then you have to put this code in the
combobox_afterupdate event
the code should then become :
txtResult=Dlookup("Result"."OtherTable","Cause='" & [comboboxName] & "'")

- Raoul
 
Back
Top