By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,846 Members | 1,211 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,846 IT Pros & Developers. It's quick & easy.

need help with query

P: n/a
I have a table of "memos". each record in that table has a primary
key "memo ID" that is autonumber. I have another table that is "memo
receipts" with each record having a "receipt id" field that is not a
primary key. When a user reads a memo, I create a receipt record that
shows that they have read and acknowledged the memo. "receipt id" is
set equal to "memo id". I have this part working fine. Next what I
want is when a user checks for new memos, I want to display only those
memos that dont have a receipt record for that user. Any memos that
have a receipt record for the current user have already been read and
acknowledged by that user. I can display the memo records very well
using a Memo form with a receipt subform. This is great but I need to
be able to only show memos that have not already been acknowledged by
the current user.

Please help
Nov 13 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
"Bob Weisenburger" <bo******@hotmail.com> wrote in message
news:77*************************@posting.google.co m...
I have a table of "memos". each record in that table has a primary
key "memo ID" that is autonumber. I have another table that is "memo
receipts" with each record having a "receipt id" field that is not a
primary key. When a user reads a memo, I create a receipt record that
shows that they have read and acknowledged the memo. "receipt id" is
set equal to "memo id". I have this part working fine. Next what I
want is when a user checks for new memos, I want to display only those
memos that dont have a receipt record for that user.


select * from memos as m
left outer join receipts as r on m.memoID = r.ReceiptID
where r.ReceiptID Is Null
Why not use a Receipt column in the memo table itself and do away with the
receipt table altogether. If you do keep the receipts table I susgest you
change the name ReceiptID to MemoID.


Nov 13 '05 #2

P: n/a
Try using an "unmatched query". This type of query will show records in one
table that don't have a matching record in the other table. To create this
type of query, go to the query tab of the database window and click the New
button. Don't use the New Query Using Wizard option in the window, use the
button on the database window. Next, choose Find Unmatched Query Wizard.

--
Wayne Morgan
MS Access MVP
"Bob Weisenburger" <bo******@hotmail.com> wrote in message
news:77*************************@posting.google.co m...
I have a table of "memos". each record in that table has a primary
key "memo ID" that is autonumber. I have another table that is "memo
receipts" with each record having a "receipt id" field that is not a
primary key. When a user reads a memo, I create a receipt record that
shows that they have read and acknowledged the memo. "receipt id" is
set equal to "memo id". I have this part working fine. Next what I
want is when a user checks for new memos, I want to display only those
memos that dont have a receipt record for that user. Any memos that
have a receipt record for the current user have already been read and
acknowledged by that user. I can display the memo records very well
using a Memo form with a receipt subform. This is great but I need to
be able to only show memos that have not already been acknowledged by
the current user.

Please help

Nov 13 '05 #3

P: n/a
Thanks Wayne, but I have already tried that. What happens is if a
memo was read by three other users other then there are repeipt
records for those users so there are "receipt id"s that match the
"memo id"s. The unmatched query only finds memo records that do not
have receipt records.

Please let me know if you have any other ideas.

thanks

"Wayne Morgan" <co***************************@hotmail.com> wrote in message news:<zx*****************@newssvr12.news.prodigy.c om>...
Try using an "unmatched query". This type of query will show records in one
table that don't have a matching record in the other table. To create this
type of query, go to the query tab of the database window and click the New
button. Don't use the New Query Using Wizard option in the window, use the
button on the database window. Next, choose Find Unmatched Query Wizard.

--
Wayne Morgan
MS Access MVP
"Bob Weisenburger" <bo******@hotmail.com> wrote in message
news:77*************************@posting.google.co m...
I have a table of "memos". each record in that table has a primary
key "memo ID" that is autonumber. I have another table that is "memo
receipts" with each record having a "receipt id" field that is not a
primary key. When a user reads a memo, I create a receipt record that
shows that they have read and acknowledged the memo. "receipt id" is
set equal to "memo id". I have this part working fine. Next what I
want is when a user checks for new memos, I want to display only those
memos that dont have a receipt record for that user. Any memos that
have a receipt record for the current user have already been read and
acknowledged by that user. I can display the memo records very well
using a Memo form with a receipt subform. This is great but I need to
be able to only show memos that have not already been acknowledged by
the current user.

Please help

Nov 13 '05 #4

P: n/a
"Bob Weisenburger" <bo******@hotmail.com> wrote in message
news:77**************************@posting.google.c om...
Thanks Wayne, but I have already tried that. What happens is if a
memo was read by three other users other then there are repeipt
records for those users so there are "receipt id"s that match the
"memo id"s. The unmatched query only finds memo records that do not
have receipt records.


Intsead of a narrative it's much better to post your actual (simplified)
table structure with some sample data and the output you need.

Will this work?

parameters [userid] varchar(50);
select * from memos as m
where not exists
(
select * from recipts as r
where r.ReceiptID = m.memoID
and r.userID = [userid]
)
Nov 13 '05 #5

P: n/a
"John Winterbottom" <as******@hotmail.com> wrote in message news:<2v*************@uni-berlin.de>...
"Bob Weisenburger" <bo******@hotmail.com> wrote in message
news:77**************************@posting.google.c om...
Thanks Wayne, but I have already tried that. What happens is if a
memo was read by three other users other then there are repeipt
records for those users so there are "receipt id"s that match the
"memo id"s. The unmatched query only finds memo records that do not
have receipt records.


Intsead of a narrative it's much better to post your actual (simplified)
table structure with some sample data and the output you need.

Will this work?

parameters [userid] varchar(50);
select * from memos as m
where not exists
(
select * from recipts as r
where r.ReceiptID = m.memoID
and r.userID = [userid]
)


Don't know how to put what you suggested in a query.
Nov 13 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.