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 November 6th, 2003, 03:06 PM
kcsabresfan kcsabresfan is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 5 kcsabresfan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
annoying problem with a query

Here's my problem... I've created a query to pull the data I need but it is not updateable. However, the whole point of the query was to update a table with it... so I have a second query that pulls the data from the first and attempts to update the table.

All I can get it to do is error out and tell me I must have an updateable query. But I'm not trying to update the query, I'm trying to update the updateable table.

first query is:
SELECT
ROUND(Avg((report.onin+report.offin)/IIf((report.son+report.soff)=0,1,(report.son+repor t.soff))),2) AS ptotal,
EIDCrossRef.EID
FROM (report INNER JOIN agent ON report.aid = agent.AGENT_ID) INNER JOIN EIDCrossRef ON agent.SOCIAL_SECURITY_NO = EIDCrossRef.SSNNumber
WHERE report.date Between [start_date] And [end_date]
GROUP BY EIDCrossRef.EID;

update query is:
UPDATE
cmgscoresdvr_cmgresults_local cmgres
SET
cmgres.ADH = (
SELECT ptotal
FROM qryReportAvgsByDate
WHERE cmgres.EID=qryReportAvgsByDate.eid)
WHERE
cmgres.YEARMONTH=[YearMonth];

Any thoughts? what can I do?

Reply With Quote
  #2  
Old November 6th, 2003, 03:38 PM
sbaxter sbaxter is offline
Moderator: Access, SQL
ASP Free God (5000 - 5499 posts)
 
Join Date: Oct 2003
Posts: 5,126 sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 1 h 2 m 51 sec
Reputation Power: 12
I'll assume the first query brings back correct info

Try this
Second query

UPDATE
cmgscoresdvr_cmgresults_local AS cmgres
INNER JOIN qryReportAvgsByDate
ON cmgres.EID = qryReportAvgsByDate.eid
SET cmgres.ADH = qryReportAvgsByDate.ptotal
Where cmgres.YEARMONTH=[YearMonth];


S-

Reply With Quote
  #3  
Old November 6th, 2003, 03:52 PM
kcsabresfan kcsabresfan is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 5 kcsabresfan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
You are correct, the first query does work correctly.

When I saw yours I thought "Why didn't I think of that" but it's not working either. Same problem.

It asks me for the start_date and end_date but then errors out. Never gets far enough to ask me for YearMonth

Reply With Quote
  #4  
Old November 6th, 2003, 06:13 PM
Doug G Doug G is offline
Grumpier Old Moderator
ASP Free God 11th Plane (10000 - 10499 posts)
 
Join Date: Sep 2003
Posts: 10,143 Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 3 Weeks 4 Days 21 h 28 m 48 sec
Reputation Power: 180
Posting your question more than once gets you fragmented answers

Reply With Quote
  #5  
Old November 7th, 2003, 07:56 AM
kcsabresfan kcsabresfan is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 5 kcsabresfan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I apologize

This was the first time I've used this forum, I wasn't sure which would be better to put it in. I started in the Access forum, then saw the SQL forum.

Anyway, you answered in the other forum:

Quote:
Give the IUSR_computername user write permissions to your access db.

http://www.dougscode.com/forum4/topic.asp?TOPIC_ID=5


This is not a server app though. I'm trying to run this directly in Access. It is to help automate someones job so that she doesn't have to do a bunch of manual calculations and entries every month.

If this were a server app (ASP or JSP) I could work around it... with simpler SQL (which would be a good thing for me!) but I need this to run directly in Access.

Thanks

Reply With Quote
  #6  
Old November 7th, 2003, 08:42 AM
kcsabresfan kcsabresfan is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 5 kcsabresfan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
thought

I can convert the first query from a select to a make table query. Then I can rewrite the update query to call from the table instead... This will work, but it means that my user has to go through 2 steps and in the correct order. Since it is just one user, and she only sits 50 feet away from me, it's not that big of a deal, but I would still like to figure it out so that she only has to run one query and it takes care of itself.

If anyone knows how to make Access understand that I'm not trying to update the non-updateable query, I'd still love to know that.

Thanks

Reply With Quote
  #7  
Old November 7th, 2003, 12:07 PM
sbaxter sbaxter is offline
Moderator: Access, SQL
ASP Free God (5000 - 5499 posts)
 
Join Date: Oct 2003
Posts: 5,126 sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 1 h 2 m 51 sec
Reputation Power: 12
You have two options.

1. Create a form that has 3 text fields on them that hold Beg_Date, End_Date, YearMonth and link you queries to this form for the parameter values and have a button on the form that executes the second query

DoCmd.OpenQuery "queryName", acViewNormal


2. Write one query the combines both actions together (it is possible)

We can help you with either option, but give the first option a try.

s-

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseMicrosoft Access Help > annoying problem with a query


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


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





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway