Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Use List box values as query criteria

Posted on 2009-04-14
2
Medium Priority
?
503 Views
Last Modified: 2012-05-06
Hi,

Please have a look at the attached test2.mdb first. There I am populating two listbox based on a dropdown selection. Now I want to run a query where I can use the selected list box values as criteria. Say I want to populate a query which retrives the result set as,

Select * from MailingList where Listbox1.value = "Pen" and ListBox2.Value = "10"

Please help.
test2.mdb
0
Comment
Question by:suvmitra
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 65

Assisted Solution

by:rockiroads
rockiroads earned 400 total points
ID: 24139616
If an item is selected in the listbox, then you can refer to that listbox in your query
eg

select * from contacts where products = forms!form1!lstContacts.value

but this will work only if form open and item selected
0
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 1600 total points
ID: 24139658
test this


test12.mdb
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

661 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question