Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

using "OR" in a ms access 2007 query prompt

Posted on 2012-03-14
4
Medium Priority
?
269 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 1000 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 1000 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

Tech or Treat! - Giveaway

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

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

Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
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…

618 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