Solved

using "OR" in a ms access 2007 query prompt

Posted on 2012-03-14
4
261 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
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 119

Accepted Solution

by:
Rey Obrero 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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

746 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now