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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Automaticlly fill a text box from a table

Status
Not open for further replies.

West48

Technical User
Mar 28, 2005
1
US
How can I fill in a text box on a form automatically when I enter a value in an other combo box on the form? Both these values come from a table that contain two fields [name] and [size]. I want to automaticlly inter [size] when I enter [name] in the combo box.
 
How about usuing the DLOOKUP function on the combo box's AFTERUPDATE event. Build the selection criteria by referencing the target box that holds the search criteria.

So if you have selected data from the combo box Combo1 then use something like
Code:
TextBoxAutofillMe.Value = Dlookup("Fld_ToLookup","TblToLookUpIn","Fld_SearchField=" & combo1.value &)

You'll have to play around with the syntax as the above is a very rough approximation of what will work for you.

Solo7 [thumbsup2]
 

An alternative is to add a hidden second column to the combo box (set the width to '0') and then refer to is in the AfterUpdate of the combo box.

TextBox=combobox.colums(1).value

Probably be faster, depending on how big the tables are.....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top