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!

My list box won't work

Status
Not open for further replies.

angiew

Technical User
Jun 22, 2000
37
US
I have a list box on a form to choose any or all of the options.&nbsp;&nbsp;The list comes from a table.&nbsp;&nbsp;The form is in turn linked to a report that will show the items filtered from the list box.&nbsp;&nbsp;The list box works in terms of allowing the user to choose any or all items.&nbsp;&nbsp;However, when the &quot;Preview Report&quot; button on the form is clicked, the report shows no records.&nbsp;&nbsp;Any ideas on why this may be happening?&nbsp;&nbsp;I will eventually need about 8 total list boxes to filter the data and produce a report based on those choices.&nbsp;&nbsp;Thanks!<br><br>Angie Wenzel<br>
 
If you mean the report is based on a query, and that query contains selection criteria that refers to the listbox in the form, then run the query independently to see if that is working.
 
Sorry, I didn't explain it very well.&nbsp;&nbsp;Yes, the Report is linked to a Query.&nbsp;&nbsp;The query runs fine.&nbsp;&nbsp;The problem occurs when I add a list box and include the addition in the query (like I did with a combo box).<br>
 
So what happens when you independently run the query using the listbox as selection criteria? Do you get an error, or the wrong result set, or an empty result set? You can paste your SQL here for us to see.
 
I don't understand what you mean by independently running the query using the listbox as selection criteria.&nbsp;&nbsp;The listbox can only be accessed from the form.&nbsp;&nbsp;Is there a way to access the listbox from the query?&nbsp;&nbsp;My SQL in the criteria portion of the query for the field related to the listbox is: [Forms]![tbl1998AttributesRVs]![Salesperson]<br><br>I am a very new user to Access, and know that I am missing some steps somewhere.&nbsp;&nbsp;Maybe some detail as to how to set up a listbox (other than the small amount of information included under the help menu) would help.<br><br>Thanks!<br><br>Angie Wenzel<br>
 
That format won't work. You should have the formname where you appear to have a table name. Check out the FAQ&nbsp;&nbsp;tab in this forum on how to use a <b>combobox</b> for this purpose. It's very similar to what you want, I <i>think</i>.
 
Actually, it is the form name, not a table name.&nbsp;&nbsp;I know it appears as though it is a table name, i.e. &quot;tbl&quot;, but that stems from the wizard I used to make the form.&nbsp;&nbsp;I let the wizard name the form and just haven't gotten around to changing the name yet.<br><br>Angie Wenzel<br>
 
OK, I get it. By running the query independently, I meant open the form, then, while it is open, run the query <i>underlying</i> the report. <br><br>That is, doubleclick on the query's name in the query tab of the database window, while the form is open and your selection criteria is displayed. To trouble shoot you have to figure out exactly what is not working, the query the report is based on, ot the report itself.
 
OK, when I run the query as you just mentioned with the form open and the selection criteria displayed (I assume by this you mean an option in the list box chosen), the query returns nothing, just field names.<br><br>Angie Wenzel<br>
 
The next step would be for you to figure out whether you have matching data in that record set. Try replace the [Forms!..]. criteria with the value. If the data exists, then you may be refering to the value incorrectly. In design view, click on the form and listbox to check their name properties. Also if there is more than one field in the rowsource, check to make sure that the vlaue you are trying to match in your query or table is the same as the <i>bound</i> field.&nbsp;&nbsp;For example, a listbox may be bound to an ID fields, but displaying a descriptive field. If so, your query has to contain the ID field in order to get a match.
 
I have discovered that the source of my problem involves the MultiSelect Property.&nbsp;&nbsp;I have this set to Extended.&nbsp;&nbsp;When I change it to None, the query works fine.&nbsp;&nbsp;You can pick an item from the list box and the correct report is produced.&nbsp;&nbsp;Is there something extra I need to do to use the MultiSelect Property with the Extended setting?<br><br>Angie Wenzel<br>
 
I'm wondering if you ever got your answer on how to correct this problem because I'm having the same issue...Did this get resolved?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top