selecting groups of records

C

chris M

In the qbe window, I would like to chose to select groups of records, For
example, in the FORM LETTER field, I want to select groups of records of
either j,k, or L that would select all of the j and k and L records, OR type
in either b, c, or d to select only, but all of, the b, c, and d records. I
dont want JKL and BCD records all at one time. I have played around and
played around with the "OR rows, and operators, parenthesis, etc, but I
cant get it to work. Either I get both sets and groups of records or just
records from 1 letter only. Help! I also thought of trying to name j,k, and L
records as "blue" and b, c, and d records as "green" and then select either
blue or green but I dont know if that will make it work, or how to do it.

Individual letters I can get to work no problem, its just groups of recs at
one time that is the problem.

Take Care, and thanks for the help, in advance. Regards, chris
 
D

Dale Fye

No easy way to do what you are looking for (from a query), but relatively
easy from a form, or by working with a table. If I wanted to select certain
records, based on the first letter of a particular field, I might try:

SELECT * FROM yourTable
WHERE LEFT(NZ([SomeField], " "),1) >= [Start letter]
AND LEFT(NZ([SomeField], " "), 1) <= [End letter]

With this query, you would get two pop-up boxes to input the first letter
for the query (b) and another for the last letter (c).

Another way to approach this would be to have a table of letters
(tbl_Letters) with one field for the letter (A-Z) and another field
(IsSelected (Yes/No)). Then you could just put a checkbox in the letters you
wanted and uncheck all the others, and write a query:

SELECT *
FROM yourTable
JOIN tbl_Letters
ON Left(NZ(yourTable.SomeField, " ", 1) = tbl_Letters.Letter
WHERE tbl_Letters.IsSelected = True


--
HTH
Dale

Don''''t forget to rate the post if it was helpful!

email address is invalid
Please reply to newsgroup only.
 
J

John Spencer

You can try the following and see if it works for you.

Field: WhateverField
Table: WhateverTable
Criteria: LIKE "[" & [Enter Letters in order] & "]*"

Then you can enter specific letters or a range of letters such as A-D.
I believe this will work for you. If not, post back for an alternative
solution.

'====================================================
John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
'====================================================
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top