Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / General 1 / January 2006

Tip: Looking for answers? Try searching our database.

Need help designing an update query

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
tbone - 21 Jan 2006 17:27 GMT
I'd like to have a way to add bidders who have won at least $1000 in
the last auction to my mailing list. I'm having trouble with the
update step.

To find bidders who have won at least $1000 in the last auction, I
created this query:

SELECT Sum(Lots.HighBidAmount) AS SumOfHighBidAmount,
Lots.HighBidderNumber
FROM Lots, [Active auctions]
GROUP BY Lots.HighBidderNumber, Lots.AuctionID
HAVING (((Sum(Lots.HighBidAmount))>=1000) AND
((Lots.AuctionID)=First([Active auctions].[AuctionID])));

[Active auctions] is a query that returns a single row identifying the
active auction. The above query, which I named "Bidders winning $1000
minimum"  appears to return the correct results.

Next, I figured I'd use the bidder numbers identified in the above
query to select the bidder records to have the mail flag set. I tried
this:

UPDATE [Bidders winning $1000 minimum]
INNER JOIN Bidders
ON [Bidders winning $1000 minimum].HighBidderNumber = Bidders.BidderID
SET Bidders.MailFlag = -1;

I get this error: "Operation must use an updateable query."

I also tried phrasing it the other way around:

UPDATE Bidders
INNER JOIN [Bidders winning $1000 minimum]
ON Bidders.BidderID = [Bidders winning $1000 minimum].HighBidderNumber
SET Bidders.MailFlag = -1;

No luck. I also tried LEFT and RIGHT JOINs, to no avail.

Can someone point me in the right direction?
Thanks
tbone
salad - 21 Jan 2006 19:16 GMT
> I'd like to have a way to add bidders who have won at least $1000 in
> the last auction to my mailing list. I'm having trouble with the
[quoted text clipped - 37 lines]
> Thanks
> tbone

Can use use something else besides a Totals query?  If you use a Totals
query, it is not updateable.  Perhaps use Dsum()?
lesperancer@natpro.com - 23 Jan 2006 12:05 GMT
update bidders
    set mailFlag = -1
where bidderId in (select highBidderNumber FROM [Bidders winning $1000
minimum]);

should work
> I'd like to have a way to add bidders who have won at least $1000 in
> the last auction to my mailing list. I'm having trouble with the
[quoted text clipped - 37 lines]
> Thanks
> tbone
tbone - 23 Jan 2006 15:08 GMT
Excellent! Works perfectly!

I did not know a SELECT could be used withing a WHERE clause.

Thanks for that valuable lesson!

tbone

>update bidders
>     set mailFlag = -1
> where bidderId in (select highBidderNumber FROM [Bidders winning $1000
>minimum]);
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.