Solved

Query not updateable

Posted on 2006-06-19
9
239 Views
Last Modified: 2008-03-03
My table maintains a log of commission changes. Fields are CommID (Primary Key, AutoNumber), Date, AccountID and CommAmt.

I use this query named "qryAcctComm" to pull the most current CommID:
SELECT tblCommissions.AccountID, Max(tblCommissions.CommID) AS MaxOfCommID
FROM tblCommissions
GROUP BY tblCommissions.AccountID;

When I create any other query based on qryAcctComm for example:
SELECT tblCommissions.CommID, tblCommissions.BaseComm
FROM tblCommissions INNER JOIN qryAcctComm ON tblCommissions.CommID = qryAcctComm.MaxOfCommID;

I cannot make updates. I am looking to update BaseComm. I assume it is because of the Max function on the Comm ID. I know I can VBA my way around this but I figured there must be a way to create an updateable query for this.
0
Comment
Question by:PaulStu
9 Comments
 
LVL 65

Expert Comment

by:Jim Horn
Comment Utility
>I assume it is because of the Max function on the Comm ID.
Correct.  Using aggregate functions in a query make it non-updatable.
0
 
LVL 65

Expert Comment

by:rockiroads
Comment Utility
Dont know if this makes it updatable, but try this

SELECT AccountID, CommID
FROM tblCommissions
WHERE CommID IN (SELECT Max(CommID) FROM tblCommissions)
0
 
LVL 44

Expert Comment

by:Arthur_Wood
Comment Utility
try this:

SELECT tblCommissions.CommID, tblCommissions.BaseComm
FROM tblCommissions where tblCommissions.CommID in (Select MaxOfCmmid from qryqryAcctComm)

This should be updateable.

AW
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 44

Accepted Solution

by:
Arthur_Wood earned 250 total points
Comment Utility
oops, fix that to read:

SELECT tblCommissions.CommID, tblCommissions.BaseComm
FROM tblCommissions where tblCommissions.CommID in (Select MaxOfCmmid from qryAcctComm)


AW
0
 
LVL 44

Expert Comment

by:Arthur_Wood
Comment Utility
ok, so why only a grade of C?  I will be very cautious about offering you answers in the future.

AW
0
 

Author Comment

by:PaulStu
Comment Utility
Thanks for making my first experience at posting a question a negative one.
1) You got the points for what turned out to be a pretty easy question.
2) You had spelling errors in your answer even after you attempted to correct it which I had to correct before I could apply your suggestion.
3) You gave me no explanation of your answer so it does not help me learn from the scenario.

So yes Arthur Wood - GRADE C Average Response for just providing the minimal answer.
I wish I knew how to email or draw the attention to the moderator for your threat!
0
 
LVL 44

Expert Comment

by:Arthur_Wood
Comment Utility
One would normally ask for additional information if it was deemed to be necessary.  I tend to be rather terse in my answers, and someone who gives a grade of C is almost universally seen as not warrnating further assistance.  We are all volunteers, and I don't 'need' the points (after all, with 10,000,000 points and $4.50 I can go to Starbucks and get a Tall Mocha Latte).

You are definitly now on my 'do not help' list.  ( I was only being 'cautious' before this)

AW
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now