Connecting Tech Pros Worldwide Help | Site Map

Update Set Statement problems

Member
 
Join Date: Feb 2008
Posts: 41
#1: Mar 28 '08
Everything I read indicates the following statement should work. What happens is that any field after the where clause gets treated as a parameter by Access. Even if I supply the data the query fails. Any ideas? Thanks, Patti
Expand|Select|Wrap|Line Numbers
  1. UPDATE teacherresources SET teacherresources.Strudent_enroll = strudent_enroll/(SELECT sum(enroll_data) FROM enrollment WHERE teacherresources.trSchool_id = enrollment.erSchool_id and year='2007-2008')*(SELECT sum(enroll_data) FROM enrollment WHERE teacherresources.trSchool_id = enrollment.erSchool_id and year='2008-2009')
  2. WHERE (((teacherresources.tryear)='2008-2009') AND ((teacherresources.trschoolid)=13));
Newbie
 
Join Date: Mar 2008
Location: Portland, Oregon
Posts: 19
#2: Mar 28 '08

re: Update Set Statement problems


Quote:

Originally Posted by patriciashoe

Everything I read indicates the following statement should work. What happens is that any field after the where clause gets treated as a parameter by Access. Even if I supply the data the query fails. Any ideas? Thanks, Patti

Expand|Select|Wrap|Line Numbers
  1. UPDATE teacherresources SET teacherresources.Strudent_enroll = strudent_enroll/(SELECT sum(enroll_data) FROM enrollment WHERE teacherresources.trSchool_id = enrollment.erSchool_id and year='2007-2008')*(SELECT sum(enroll_data) FROM enrollment WHERE teacherresources.trSchool_id = enrollment.erSchool_id and year='2008-2009')
  2. WHERE (((teacherresources.tryear)='2008-2009') AND ((teacherresources.trschoolid)=13));

What is the whack "/" after "strudent_enroll on the first line? Also, usually when you get a prompt for a parameter like that, it's because you've misspelled a word in the string. Do you really have a field named "strudent"? Next to this, I'd suggest pulling the fields into a query grid to get the SQL straight for Access as its version of SQL can be a little different than ANSI.
Reply