View Full Version : help with Criteria in query


ryannnnstl
12-22-2009, 06:24 AM
hello,I am new to access and have run into a problem.

i have a query that returns information for hundreds of accounts. I only want to return information for about 50 of those accounts. When I try to put the accounts I want to return into the criteria box (example "012345" or "123456" or "234567" or ...) I run out of space eventually. It says there is a 1,024 character limit.

Is there a way I can create a table and have the query return only accounts that are specified in the table?

Thanks in advance!
Rm

JohnLee
12-22-2009, 06:30 AM
Hi,

Yes there is, but in order to help you, you will need to provide more information about the table(s) on which your query is based and more information about your query.

Dependant on how you have organised your table and query will determine weather or not anymore work needs to be done to achieve your desired result.

John

Brianwarnock
12-22-2009, 06:38 AM
I'm unclear as to what other information John requires. A simple 1 field table of the accounts required , default joined to the accounts in the main table will select only records where the account is in both. It is infact a very efficient way to do this.

Brian

ryannnnstl
12-22-2009, 06:48 AM
the table of accounts I wish to have information returned is filled down the column in a table called accttable.
acctnum
012345
123456
234567

the query is organized by each of the transactions per account
acctnum--------transactiontype--------producttype
012345--------bought--------producta
012345--------bought--------productb
123456--------bought--------producta
234567--------bought--------producta
234567--------bought--------productc
345678--------bought--------producta
456789--------bought--------producta

so the final result would return only transactions for the accounts that I specified in accttable.

012345 bought producta
012345 bought productb
123456 bought producta
234567 bought producta
234567 bought productc

Brianwarnock
12-22-2009, 06:52 AM
So you join accttable.acctnum to maintablename.acctnum

Brian

ryannnnstl
12-22-2009, 06:57 AM
So you join accttable.acctnum to maintablename.acctnum

Brian

i really appreciate the help. Where do i put this code? or better yet what is this sort of thing called? I am new to access and just learning.

Thanks for your patience!^_^

Brianwarnock
12-22-2009, 07:01 AM
In the Design grid select both tables, then drag a join line from one tables field to the other, tho' I suspect as they are the same name and both should be primary key fields ACCESS will automatically make the link.

Read about joins in help.

Brian

ryannnnstl
12-22-2009, 07:06 AM
Got it! Thanks!