Re: Query based on other queries problem
- From: John Spencer <spencer@xxxxxxxxxx>
- Date: Sat, 29 Mar 2008 13:23:45 -0400
Some comments:
First and Last don't necessarily return the oldest or newest record added to the database or the earliest or latest value.
Not enough details to really propose a solution, but you might be able to use sub-queries in a where clause to solve your problem of the query not being updatable. You can use a group by query in the where clause and that will not affect the update capability of the query itself.
Assumptions:
EventClients table contains a list of clients for an event (0 to many)
Events table contains records with data on an event
The following query with a correlated subquery should be updatable (assuming that it is without the where clause) and should display one clientId for each event.
SELECT *
FROM Events Inner Join EventClients
On Events.EventID = EventClients.EventID
WHERE EventClients.ClientID =
(SELECT Max(ClientID) FROM EventClients as C
WHERE C.EventID = EventClients.EventID)
'====================================================
John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
'====================================================
Gridrunner wrote:
I am trying to find a work-around for the read-only problem when a query has a Group By clause in it. I am working in Access 2007. Here is a summary of what I am doing:.
I receive orders from my clients that contain personal data about people. Often a given order is for multiple people. I have a form that displays summary data for a specific order, and only lists the name of the first person on the order. I also have a table that keeps track of various "milestone" events for each order, such as when the order was received, when it was completed, etc. Each of these events sets the order status to a particular value, and my summary table displays only the current status. The query I use is based on a number of preliminary queries in order to assure that I only receive the data I want and not a line for each combination of name and event for an order. To achieve this, two of my precursor queries use Group By functions (First() for the name, and Last() for the event). I then use this information to pull together my sumary data. The query directly behind the form does not use any Group By functions itself, but this does not prevent the read-only problem.
I think I have a solution to this this would use VB. I am proficient in VB, so this would not present a problem. However, the solution seems very klunky and inefficient. Does anyone have a better solution?
- Follow-Ups:
- Re: Query based on other queries problem
- From: Gridrunner
- Re: Query based on other queries problem
- References:
- Query based on other queries problem
- From: Gridrunner
- Query based on other queries problem
- Prev by Date: RE: Result of Expression Isn't Showing Up in Query
- Next by Date: Re: How many nulls in each field?
- Previous by thread: Query based on other queries problem
- Next by thread: Re: Query based on other queries problem
- Index(es):
Relevant Pages
|