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!

ListBox/RecordSource Property Question

Status
Not open for further replies.

TeresePamela

Programmer
Sep 4, 2003
40
US
The background:
A user selects 1 of 4 fields to search on by selecting from an Option Box, this selection opens a 2nd form, the user then enters the desired criteria into a text-box on the 2nd form and clicks a "search" button. I'm ok to this point and have the values of both forms (option and criteria) stored and passing ok.
My Problem:
When the user clicks the search button of the 2nd form I want a 3rd form to display the file in list-box format, with the data sorted on the field selected in form 1 and with the first displayed record being the FindFirst that matches the criteria in form 2 (which may be a partial entry). I thought of creating four queries for the sort criteria and using the queries as the recordsource of the listbox, but can I change the value of the recordsource property via vba (which I would do based on the option selected in form 1)? And how in the world would I get the listbox to go directly to the first find of the criteria???

As always any input will be greatly appreciated.

Pam
 
Yes, in VBA you may set the RowSource property of the ListBox to a string containing your dynamically builded SELECT instruction.

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