Solved

Query not updateable

Posted on 2006-06-19
9
243 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
ID: 16936970
>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
ID: 16937157
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
ID: 16937179
try this:

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

This should be updateable.

AW
0
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
LVL 44

Accepted Solution

by:
Arthur_Wood earned 250 total points
ID: 16937187
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
ID: 16939677
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
ID: 16943073
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
ID: 16944884
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
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…

821 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