Solved

using "OR" in a ms access 2007 query prompt

Posted on 2012-03-14
4
264 Views
Last Modified: 2012-03-14
I have a query that I need the prompt on a field called "charge_code" to allow multiple entries. Without a prompt the field criteria might look like "LA1234 or LA9876". My plight is sometimes there may be 2 entries, sometimes 3 or more and sometimes it just might be one entry.
0
Comment
Question by:howcheat
[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
4 Comments
 
LVL 77

Assisted Solution

by:peter57r
peter57r earned 250 total points
ID: 37721034
For your criteria use....

WHERE instr( [Enter list with commas],Chargecode)>0

This assumes that one field value is not wholly contained in another value.
(won't deal properly with Smith, smithson)
0
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 250 total points
ID: 37721064
to deal with not finding the correct info, add "," in both sides of the parameters

WHERE instr("," &  [Enter list with commas] & ",", "," & [Chargecode] & ",")>0
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 37721089
Why not make this easy on your users (and yourself as the developer)  and use a multiselect listbox?

http://access.mvps.org/access/forms/frm0007.htm
http://access.mvps.org/access/reports/rpt0005.htm

JeffCoachman
0
 

Author Closing Comment

by:howcheat
ID: 37721290
listbox doesn't seem feasible for 1.4 million records.

peter57r and capricorn1: that's what I'm looking for!
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

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…
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

740 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