?
Solved

using "OR" in a ms access 2007 query prompt

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
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…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

764 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