We help IT Professionals succeed at work.

using "OR" in a ms access 2007 query prompt

howcheat
howcheat asked
on
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.
Comment
Watch Question

CERTIFIED EXPERT
Commented:
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)
CERTIFIED EXPERT
Top Expert 2016
Commented:
to deal with not finding the correct info, add "," in both sides of the parameters

WHERE instr("," &  [Enter list with commas] & ",", "," & [Chargecode] & ",")>0
Jeffrey CoachmanMIS Liason
CERTIFIED EXPERT
Most Valuable Expert 2012

Commented:
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

Author

Commented:
listbox doesn't seem feasible for 1.4 million records.

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

Explore More ContentExplore courses, solutions, and other research materials related to this topic.