473,792 Members | 2,796 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

need help with query

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
5 1788
"Bob Weisenburger" <bo******@hotma il.com> wrote in message
news:77******** *************** **@posting.goog le.com...
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
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******@hotma il.com> wrote in message
news:77******** *************** **@posting.goog le.com...
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
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******* **********@news svr12.news.prod igy.com>...
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******@hotma il.com> wrote in message
news:77******** *************** **@posting.goog le.com...
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
"Bob Weisenburger" <bo******@hotma il.com> wrote in message
news:77******** *************** ***@posting.goo gle.com...
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
"John Winterbottom" <as******@hotma il.com> wrote in message news:<2v******* ******@uni-berlin.de>...
"Bob Weisenburger" <bo******@hotma il.com> wrote in message
news:77******** *************** ***@posting.goo gle.com...
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
1325
by: Masterpop | last post by:
Hi, I have the following table: Column 1 Column 2 A A A B A C B F B F
10
2596
by: L. R. Du Broff | last post by:
I own a small business. Need to track a few hundred pieces of rental equipment that can be in any of a few dozen locations. I'm an old-time C language programmer (UNIX environment). If the only tool you know how to use is a hammer, every problem tends to look like a nail. That said, I could solve my problem in C, but it's not the right tool. I need to come into the Windows world, and I need to get this done in Access or something...
1
3484
by: Aaron West | last post by:
Try this script to see what queries are taking over a second. To get some real output, you need a long-running query. Here's one (estimated to take over an hour): PRINT GETDATE() select count_big(*) from sys.objects s1, sys.objects s2, sys.objects s3, sys.objects s4, sys.objects s5 PRINT GETDATE()
0
1273
by: vinod | last post by:
Dear experts i need a query like this i have a table like this. accno name amount running_total 1 a 50 50 2 b 60 110
0
1007
by: Rational Repairs | last post by:
I have a query situation I can't, for the life of me, figure out. Any help would be greatly appretiated. I have a table of customers, and a seperate table of orders. An order consists of (among other things) a Buyer and an End User. A single customer can be a buyer, end user, both, or neither. Also a single customer can have many orders with the aforementioned criteria. I simply want a query that will show all customers who are either...
1
270
by: kev | last post by:
Hi folks, Firstly, Happy New Year to all. I have some problems with query pls help.I have 4 tables namely Equipment,Safety1,Safety2,Safety3. some of the fileds in each table is shown below. equipment: requestorname,building,equipmentid(pk),WWID safety1:status,equipmentid safety2:requeststatus,equipmentid safety3:status3,equipmentid
5
1536
by: Karthik D V | last post by:
Hello All, I have a table like this ID CHARACTER ----------- --------- 1 A 2 A 3 B 4 B
2
1212
by: viki1967 | last post by:
Hi everyone. I have this table : http://www.complessobandisticopalombarasabina.it/viki1967/immagine.jpg Need extraction query: ***************************************
4
1546
by: muhammadrashidmughal | last post by:
columns f1 f2 f2 f4 f5 f6 f7 f8 ...... 1 2 3 4 . . i have a table in which multiple columns and records more than 1000 , i need a query to convert these records in columns and columns in rows.
4
1765
by: asivakrupa | last post by:
Hi, I need a query in SQL Sever which will select the records based on the date of creation.The query is, List the opportunity name where the date of creation is before 3 weeks. I do not know to create a SQL query for this. Pls do help me out with this. Thanks in advance. Sivakrupa Arulmani.
0
9518
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10430
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9033
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6776
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5436
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5560
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4111
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3719
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2917
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.