Microsoft Access Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseMicrosoft Access Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old September 12th, 2007, 02:11 PM
ddohnggo ddohnggo is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2007
Posts: 1 ddohnggo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 25 m 40 sec
Reputation Power: 0
Queries - MS ACCESS Jet SQL: Update statements that utilize saved queries/dmax

Hi,

I'm trying to make a very simple update statement (in Oracle/sql server, etc...) in jet sql that seems much more difficult than it should be.

The root of my problem is that I'm trying to update a field on a table
using dmax, which references another query to update the table.
Although I have all of the correct keys from the physical table joined
to the query in the dmax function, the code/ms access seems to ignore
the joins. As a result, all payees are having their "vol" field set
instead of a select subset that is returned by the saved query.

Saved Query (GetTxnVolAmtTR"):

SELECT p.payee_id, sum(txn_volume) AS vol, t.market, t.period_id
FROM ft_payees AS p, ft_txn_summary AS t
WHERE p.payee_id=t.payee_id And p.market=t.market
GROUP BY t.payee_id, t.period_id, t.market, p.payee_id;

Update statement (references the query above):

UPDATE tmp_ft_component AS rc
SET rc.volume = Dmax("vol","GetTxnVolAmtTR","GetTxnVolAmtTR.payee_ id=
" & [rc.payee_id] And "GetTxnVolAmtTR.market= " & [rc.market] And
"GetTxnVolAmtTR.period_id= " & [rc.period_id] & "")
WHERE rc.component_name='Total Revenue';

I've tried fixing the joins to:

DMax("vol", "GetTxnVolAmtTR", "GetTxnVolAmtTR.payee_ id= " &
[rc.payee_id] & " And GetTxnVolAmtTR.market= " & [rc.market] & " And
GetTxnVolAmtTR.period_id= " & [rc.period_id] & "")

but that just sets the values to null.

----------------------

Another possible way of going about this problem is to utilize the
saved query like a table and do something like the following:

UPDATE tmp_ft_component AS rc inner join on GetTxnVolAmtTR as tr
SET rc.volume = tr
WHERE rc.component_name='Total Revenue'
AND tr.payee_id = rc.payee_id
AND rc.market = tr.market
AND tr.period_id = rc.period_id;

I've tried running it and it gives me the "not an updateable
statement." something I'm quite familiar with after wrestling with
Jet SQL for some time.

Questions:
1) What am I missing on the field joins on the Dmax function?
2) Is it possible to join to a saved query like a table for update
statements? I know they work if you just do a simple select.

Any help would be much appreciated.

Thank you!

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseMicrosoft Access Help > Queries - MS ACCESS Jet SQL: Update statements that utilize saved queries/dmax


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump



 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT