Wrox Programmer Forums
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old May 5th, 2009, 01:03 PM
Posts: n/a
Default Listbox as Query Criteria


I know this is probably asked many times but simple straigh fwd way to do this w/o vba?
Like put the criteria in the query from a multi select list box ... and if nothing is selected iif ... then display field.

If only way is vba who has the most efficient code for this?
please note this is a list box not combo box .... list box with 1 column ....

Old May 6th, 2009, 08:45 AM
Friend of Wrox
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts

You could use the button wizard, then open your query, form or report, and tell the wizard that you want it linked to a control on your form, and select the listbox. This will write code, of course, but you won't have to see it.

Did that help? Otherwise you need the code.

Look it up at: http://wrox.books24x7.com
Old May 7th, 2009, 05:52 PM
Authorized User
Join Date: Jul 2008
Posts: 38
Thanks: 1
Thanked 2 Times in 2 Posts

If it is a single select list box then you can just reference it in the query as criteria. If it is multi-select then you would need to build the criteria by iterating through using VBA. Which do you have?

Bob Larson
Access MVP (2008-2010, 2011)
Free Access tutorials, samples, tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
ListBox as Query criteria? PubliusHJM Access 8 August 28th, 2007 06:14 AM
Conditional criteria in query dfuas Access 1 January 21st, 2006 03:39 AM
Query : listbox column in criteria Freddyfred Access 0 August 12th, 2004 08:00 PM
Criteria in Query lryckman Access 1 June 23rd, 2004 11:11 AM
Query Criteria Clive Astley Access 4 March 25th, 2004 03:27 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.