473,587 Members | 2,527 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Query based Report with One-to-Many Table Relationship

I have a primary table (containing basic contact information) and a
number of subsidiary tables (containing various additional information)
for employees.

Most of the subsidiary tables have a One-to-One relationship with the
primary table.

There is an exception. The employees attend various events and I have a
subsidiary table that tracks the Start Date and End Date of these
events.

Since each employee can (and frequently does) attend more than 1 event
over the course of time, this subsidiary table has a One-to-Many
relationship to the primary table.

I am setting up a query (used as the basis for a report) that grabs
fields from the primary table and a number of subsidiary tables,
including the Event table with the One-to-Many relationship to the
primary table.

What I want is to be able to (for a given employee) grab the Start Date
and End Date of only the most recent (by Start Date) event from the
Events table.

How do I do this?
Nov 12 '05 #1
2 2133
See:
http://www.mvps.org/access/queries/qry0020.htm
for 4 possible approaches.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Todd D. Levy" <us************ **@spamex.com> wrote in message
news:MP******** *************** *@nyc.news.spea keasy.net...
I have a primary table (containing basic contact information) and a
number of subsidiary tables (containing various additional information)
for employees.

Most of the subsidiary tables have a One-to-One relationship with the
primary table.

There is an exception. The employees attend various events and I have a
subsidiary table that tracks the Start Date and End Date of these
events.

Since each employee can (and frequently does) attend more than 1 event
over the course of time, this subsidiary table has a One-to-Many
relationship to the primary table.

I am setting up a query (used as the basis for a report) that grabs
fields from the primary table and a number of subsidiary tables,
including the Event table with the One-to-Many relationship to the
primary table.

What I want is to be able to (for a given employee) grab the Start Date
and End Date of only the most recent (by Start Date) event from the
Events table.

How do I do this?

Nov 12 '05 #2
Thanks Allen.

This was very helpful; I adapted one of these solutions to my needs.

In article <40************ **********@free news.iinet.net. au>,
Al*********@See Sig.Invalid says...
See:
http://www.mvps.org/access/queries/qry0020.htm
for 4 possible approaches.

Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1638
by: jwad01 | last post by:
I have a stored procedure that gets executed by a Crystal Report. The report runs in about a minute. Using profiler, I get the SP that was executed by the report and run it in Query Analyzer. In Query Analyzer the SP runs in about an hour. Has anyone see this or know what is happening? Thanks
4
1865
by: Minitman | last post by:
I have an address database and I want to have the query prompt for me to enter an expression that will bring up ALL names begining with same first ltr for individual page on my report. I am familiar with prompt in query design but it doesn't bring up all A's or B's individually. If I type in complete name it brings them up. If I go in query...
2
2228
by: Jur Schagen | last post by:
I have this weird sorting problem. I have a report that is based on a query. The query is sorted on field A, and if I run it seperately it is decently sorted on that field. However, if I call the report, it is sorted on field B. I am not using the "Order by"-property of the report; in fact, if I say "Field A" in it, the report is STILL sorted...
1
1276
by: novice_in_ny | last post by:
I have a simple form that takes in a UPC code of an item and after I enter the record, I would like to do an inner join to get a couple of fields from another table that is joined on the UPC code and then print a receipt. Do I do this with Visual Basic procedure after the insert and how do I carry out the simple print job onto a receipt...
2
1515
by: starke1120 | last post by:
I have a query that has a prompt for date as Between And This database is hosted on a share drive. About half of my user's are ok with the report that has this query the other half when the prompt comes up for the first sections the box displays Enter Start Date - Format "MM/DD/YYYY:,2
4
9462
by: Simon | last post by:
Dear reader, The syntax for Docmd.OpenReport is: OpenReport(ReportName, View, FilterName, WhereCondition, WindowMode, OpenArgs) Example The following example prints Sales Report while using the existing query
12
2097
by: bhipwell via AccessMonster.com | last post by:
Hello, I have hit the "Cannot open any more databases" and "System resource exceeded" errors. Knew this was coming, but as I got closer to finishing the database, I hoped it wouldn't be an issue. My DB consists of hundreds of unique pieces of information (in atomic tables of course). However, I have many multiple queries that are...
5
1959
by: margot | last post by:
Hello, I created a listbox with companies names and when the user selects a company a report is generated based on the company name. I created a Function below and then I created a button that will call the function and the report will be generated. If I dont select any field the report is generated showing me all fileds otherwise it gives me an...
5
1455
by: bobh | last post by:
Hi All, Is there a difference in preformance between the two; TblNme has 36 fields across a record a query that selects all fields and the report only uses 75% of the fields, ie; Select TblNme.* where OffCde='123' or
2
1693
by: cpStar | last post by:
I have a report grouped by a location field. In the detail section it shows several columns such as 1st name, last name, city, st, zip & company name. My user would like his report sorted based on the value of that location field. For example, if the location is "NE" then sort the detail by City but if the location is "SE" then sort the detail...
0
7920
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7849
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...
0
8215
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. ...
0
8347
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
8220
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
3844
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...
0
3879
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1454
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1189
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...

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.