Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

manually adding to a recordset

Status
Not open for further replies.

NeilBelgium

IS-IT--Management
Joined
Sep 18, 2001
Messages
87
Location
BE
dear all,

I have a recordset drawn from four rows of my db. I've recently added a fifth, and wish to amend the rs accordingly.
I simply copied and pasted the original and changed the variable name.

It all looks OK to me, but in testing the recordset I get the error:
[odbc access driver]. Too few parameters. expected 1.

i copy the two statements (original & amended) below. i really can't see what the problem is!

original:
rsReport1.Source = "SELECT *, (SELECT (SUM(BOSS)/4) FROM REPORTS WHERE MGR_DIR = '" + Replace(rsReport1__MMColParam, "'", "''") + "' AND Q_NUMBER IN (1,2,3,4)) AS BOSSES, (SELECT (SUM(COLLEGUE)/4) FROM REPORTS WHERE MGR_DIR = '" + Replace(rsReport1__MMColParam, "'", "''") + "' AND Q_NUMBER IN (1,2,3,4)) AS COLLEGUES, (SELECT (SUM(SUBORDINATE)/4) FROM REPORTS WHERE MGR_DIR = '" + Replace(rsReport1__MMColParam, "'", "''") + "' AND Q_NUMBER IN (1,2,3,4)) AS SUBORDINATES, (SELECT (SUM(CUSTOMER)/4) FROM REPORTS WHERE MGR_DIR = '" + Replace(rsReport1__MMColParam, "'", "''") + "' AND Q_NUMBER IN (1,2,3,4)) AS CUSTOMERS FROM REPORTS WHERE MGR_DIR = '" + Replace(rsReport1__MMColParam, "'", "''") + "' AND Q_NUMBER IN (1,2,3,4)"

amended:
rsReport1.Source = "SELECT *, (SELECT (SUM(BOSS)/4) FROM REPORTS WHERE MGR_DIR = '" + Replace(rsReport1__MMColParam, "'", "''") + "' AND Q_NUMBER IN (1,2,3,4)) AS BOSSES, (SELECT (SUM(SELF)/4) FROM REPORTS WHERE MGR_DIR = '" + Replace(rsReport1__MMColParam, "'", "''") + "' AND Q_NUMBER IN (1,2,3,4)) AS SELFS, (SELECT (SUM(COLLEGUE)/4) FROM REPORTS WHERE MGR_DIR = '" + Replace(rsReport1__MMColParam, "'", "''") + "' AND Q_NUMBER IN (1,2,3,4)) AS COLLEGUES, (SELECT (SUM(SUBORDINATE)/4) FROM REPORTS WHERE MGR_DIR = '" + Replace(rsReport1__MMColParam, "'", "''") + "' AND Q_NUMBER IN (1,2,3,4)) AS SUBORDINATES, (SELECT (SUM(CUSTOMER)/4) FROM REPORTS WHERE MGR_DIR = '" + Replace(rsReport1__MMColParam, "'", "''") + "' AND Q_NUMBER IN (1,2,3,4)) AS CUSTOMERS FROM REPORTS WHERE MGR_DIR = '" + Replace(rsReport1__MMColParam, "'", "''") + "' AND Q_NUMBER IN (1,2,3,4)"


thanks!
 
Try using a copy of the page and let UD build your sql and see what statement is generated Live long and make your kids suffer..
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top