Solved

Query not updateable

Posted on 2006-06-19
9
241 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
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 
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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
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.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

863 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

27 Experts available now in Live!

Get 1:1 Help Now