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

Binding a Query to unbound list object in code???

Status
Not open for further replies.

bjdobs

Programmer
Mar 11, 2002
261
CA
Having a gey moment ... attempting to fix a broken database with recovered queries and data.

A query which references form fields is not binding to a list control in the forms design mode

SELECT tablename.tablefield
FROM tablename
WHERE tablename.tablefield2 = ([forms]![thisformsname].[formfield]);

I am thinking this is probably a good thing because there are several list objects each dependant on the previous selection ... so I have set the list control to UNBOUND ... is there an easy or recommended way to bind the query to the unbound control on condition from code so it can be requeried as required???

I am thinking that there must be a way to use a DAO object (container) and dynamically bind it to the list's object container?

The hard/slow way is to delete the all list elements then add all elements from the query container one at a time.
 
Take a look at the RowSourceType and RowSource properties of the ListBox object.
And depending of your version of access you may even consider its Recordset property.

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