AllExperts > Using MS Access 
Search      
Using MS Access
Volunteer
Answers to thousands of questions
 Home · More Using MS Access Questions · Answer Library  · Encyclopedia ·
More Using MS Access Answers
Question Library

Ask a question about Using MS Access
Volunteer
Experts of the Month
Expert Login

Awards

About Us
Tell friends
Link to Us
Disclaimer

 
 
 
 
About Scottgem
Expertise
I can answer almost all types of questions relating to Microsoft Access usage and application design. My strengths are database and interface design.

Experience
I've been designing databases for over 15 years working with dBase, FoxPro, Approach and Access.

Organizations
Author of Microsoft Office Access 2007 VBA
Techncial Editor for Special Edition Using Microsoft Access 2007 and Access 2007 Forms, Reports & Queries From Que Publishing

 
   

You are here:  Experts > Computing/Technology > Business Software > Using MS Access > Queries in a table

Using MS Access - Queries in a table


Expert: Scottgem - 11/2/2009

Question
Scott,

I have an "Events" table uses a separate "Companies" table for its company source (using Companies.ID for linking and Companies.Company for name display) and houses all of our meeting data.  Each meeting contains an event date, a company field (as mentioned above), an event type and attendees.  Separately, in my Companies table, there is a yes/no field titled "Watch List."  I'm trying to generate a query that will take the Companies on the "Watch List" and pull the most recent (ie MAX) date from the Events table to let me know the last time I had contact with each of those companies.  I'm not able to get the results I want.  When I try to use a join equating the Company names (Events.Company = Companies.Company), I get no results.  When I try to equate the Companies.ID to Events.Company, I get a type mismatch error.  Not really sure how to proceed.  Thanks.

cheers,
DJ

Answer
You need to create a Top N of Group query. This article tells you how. You want to create the TOP 1 of each company sorting by event date in descending order. Then join that query top your company query on CompanyID.

Hope this helps,
Scott<>
Microsoft Access MVP 2007
Author: Microsoft Office Access 2007 VBA

Add to this Answer   Ask a Question


 
User Agreement | Privacy Policy | Kids' Privacy Policy | Help
Copyright  © 2008 About, Inc. AllExperts, AllExperts.com, and About.com are registered trademarks of About, Inc. All rights reserved.