Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Active combo box

Status
Not open for further replies.

severin

Technical User
Jun 4, 2004
23
0
0
DK
In a subform you chose from a combo box. When the choice has been made I need a text box next to the combo box that looks up and returns a text related to the choice in the combo box. It has to come up right away.

How do I wing it!

The form is based on a query and the rowsource of the combo box is based on a query.
 
Include the field that contains the value for your adjacent field in the rowsource for the combo.
Then in the afterupdate event procedure for the combo use something like:

me.mynexttextbox = me.cboMycombo.Column(2) where the column number is the column that contains your required value. Column numbers start from 0.
 
Hí lupins46
Thanks for responding.

How do I include the field. I can't do it in the query 'cause then I won't get any hits. I tried just writing AND [..... etc.. at the end of the rowsource but I couldn't get it to work.
 
Use a dlookup as the control source for the text box.

=dlookup("RelatedInfo","TableName","ComboBoxInfo = '" & me.ComboBoxName & "'")

=dlookup("RelatedInfo","TableName","ComboBoxInfo = me.ComboBoxName)

use the first example if the combo box info is text, use the second one if it's numerical.


Randy
 
The combo box info is text but I can't seem to write the sentence the right way. Could you give an example that might make it easier for me to understand.
 
What's wrong with:

=DLookUp ("[ostebedømmelse produktfejl]", "Karakter bredde", "[Produktfejl]=" & Forms![Formular bedømmelse]![bedømmelse underformular]![fejl ydre])
 
You need the single quotes around the text.....

=DLookUp ("[ostebedømmelse produktfejl]", "Karakter bredde", "[Produktfejl]='" & Forms![Formular bedømmelse]![bedømmelse underformular]![fejl ydre] & "'")

Randy
 
I tried copy and paste but it complains about the syntaks???
 
Try something like this:
=DLookUp ("[ostebedømmelse produktfejl]", "[highlight][[/highlight]Karakter bredde[highlight]][/highlight]", "[Produktfejl]=" & Forms![Formular bedømmelse]![bedømmelse underformular][highlight].Form[/highlight]![fejl ydre])
Provided that:
[Karakter bredde] is the name of a Table or Query
[ostebedømmelse produktfejl] is the name of a column in the above table/query
[Produktfejl] is the name of a numeric column in the above table/query
[bedømmelse underformular] is the name of the control hosting the subform
If [Produktfejl] isn't defined as numeric, try this:
=DLookUp ("[ostebedømmelse produktfejl]", "[highlight][[/highlight]Karakter bredde[highlight]][/highlight]", "[Produktfejl]=[highlight]'[/highlight]" & Forms![Formular bedømmelse]![bedømmelse underformular][highlight].Form[/highlight]![fejl ydre][highlight] & "'"[/highlight])

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
I just can't get it to work..............
 
Are all the assertions below the Provided that: line of my previous post met ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top