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!

Setting a combo box to a table

Status
Not open for further replies.

SharonA

Programmer
Jun 22, 2000
2
US
How can I set a combo box or list box to pull data from a table? All I can see in the properties is the Define Values wizard that wants a typed list.
 
Defining a standard field as a type &quot;combo box&quot; will not achieve the results you want.<br><br>Paradox 8 and 9 (maybe 7 too) comes with some Active X controls including a combo box that you can tie to a table.&nbsp;&nbsp;Display the Active X toolbar and check out &quot;combobox&quot; in the online help.<br><br>Hope that helps.<br><br>P.A.L.
 
Actually, I worked and worked on this and found an answer:<br><br>The DataSource command will fill a combo box that is specified as a combo box with the fields left blank. I ran a programmed query and set the datasource to Answer.<br><br>It was a little more complex to get the second combo box to respond &quot;on the fly&quot; to the data in the first. I ran a second query from the value selected in the first box (in Depart), then, right after that in the same code, used fieldname.listname.list.Count = 0 to empty the second list, then refilled it with fieldname.listname.datasource = &quot;[:pRIV:Answer.fieldname]&quot;<br><br>It might be simpler to use the ActiveX; I'll give it a try.
 
Sharon,<br><br>Wow.&nbsp;&nbsp;I just learned something you might find useful.&nbsp;&nbsp;You can easily set the list values of a field with the properties of a combo box.<br><br>Add the line:<br>self.datasource = &quot;[TABLENAME.FIELDNAME]&quot;<br><br>to the list object of the combo box in the Arrive method.&nbsp;&nbsp;The mistake I've always made was trying to set the command in the arrive event for the field.&nbsp;&nbsp;There is a sub-element of the combo box called #list[somenumber].&nbsp;&nbsp;The syntax for the line includes the quotes and the square brackets.&nbsp;&nbsp;Replace TABLENAME and FIELDNAME with the required table and field.<br><br>I can't believe it worked.<br><br>Good luck, Pat<br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top