opening same kind of recordset gives error for one while not for o

opening same kind of recordset gives error for one while not for o

am 28.12.2004 18:47:03 von jack

Hi,
Using a login userid, I am trying to go to a asp page which will display the
values for the particular record. The asp page has quite a few recordsets in
the form of Access stored query. Now for the first recordset, I do not get an
erro while for the second recordset, I am getting an error message which i
have attached here. I have no idea why this is happening. I appreciate any
help here. I am attaching the two sets of code, the second one throws the
error. Thanks.

RS.Open "Select * from GMISExpenseCombo1 where IntID = "& GrantID & ";"

RSTotalOutlay.Open "Select * from qryTotalOutlay1 where IntID = "& GrantID &
";"

ERROR MESSAGE:

Microsoft OLE DB Provider for ODBC Drivers (0x80040E10) [Microsoft][ODBC
Microsoft Access Driver] Too few parameters. Expected 1.

Re: opening same kind of recordset gives error for one while not for o

am 28.12.2004 19:36:37 von Alistair

"Jack" wrote in message
news:96C8490C-BAC6-4740-AA5A-AE1198C8D7F4@microsoft.com...
> Hi,
> Using a login userid, I am trying to go to a asp page which will display
> the
> values for the particular record. The asp page has quite a few recordsets
> in
> the form of Access stored query. Now for the first recordset, I do not get
> an
> erro while for the second recordset, I am getting an error message which i
> have attached here. I have no idea why this is happening. I appreciate any
> help here. I am attaching the two sets of code, the second one throws the
> error. Thanks.
>
> RS.Open "Select * from GMISExpenseCombo1 where IntID = "& GrantID & ";"
>
> RSTotalOutlay.Open "Select * from qryTotalOutlay1 where IntID = "& GrantID
> &
> ";"
>
> ERROR MESSAGE:
>
> Microsoft OLE DB Provider for ODBC Drivers (0x80040E10) [Microsoft][ODBC
> Microsoft Access Driver] Too few parameters. Expected 1.
>
>
>

possible spelling mistake??..at least thats what I always have when I get
that error message..

have you tried a response.write?

Re: opening same kind of recordset gives error for one while not for o

am 28.12.2004 19:38:40 von reb01501

Jack wrote:
> Hi,
> Using a login userid, I am trying to go to a asp page which will
> display the values for the particular record. The asp page has quite
> a few recordsets in the form of Access stored query. Now for the
> first recordset, I do not get an erro while for the second recordset,
> I am getting an error message which i have attached here. I have no
> idea why this is happening. I appreciate any help here. I am
> attaching the two sets of code, the second one throws the error.
> Thanks.
>
> RS.Open "Select * from GMISExpenseCombo1 where IntID = "& GrantID &
> ";"

The
& ";"
is totally unnecessary.

>
> RSTotalOutlay.Open "Select * from qryTotalOutlay1 where IntID = "&
> GrantID & ";"
>
> ERROR MESSAGE:
>
> Microsoft OLE DB Provider for ODBC Drivers (0x80040E10)
> [Microsoft][ODBC Microsoft Access Driver] Too few parameters.
> Expected 1.


This usually points to the use of a reserved keyword for a column or table
name. Without seeing he sql of the saved query it's impossible to tell for
sure. Here is a list of reserved keywords that need to be avoided when
naming your database objects:
http://www.aspfaq.com/show.asp?id=2080

Show us the sql of the saved query if this does not get you going.

HTH,
Bob Barrows

PS. You really should avoid "Select *" in your production code:
http://www.aspfaq.com/show.asp?id=2096

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.

Re: opening same kind of recordset gives error for one while not f

am 28.12.2004 20:01:03 von jack

Hi Bob,
I just checked the stored query GMISExpenseCombo1 and did not find any
reserved word for any field. Since I cannot post the QBE format of the stored
query, I am just sending the sql text format of the query here. Thanks for
your help and I am going to read the article on not using * in the select
statment.

SELECT tblGMISExpenditures.SubgrantIntID,
Sum([Personnel]+[ContractedServ]+[Travel]+[Equipment]+[Opera ting]+[SecureDetention]+[SecureTransport]+[NonSecureDetentio n]+[ElectronicMonitor])
AS TotalOutlay, Sum(tblGMISExpenditures.LocalShare) AS TotalLocalOutlay,
tblGMISExpenditures.UnpaidOblig AS TotalUnpaidObligation,
tblGMISExpenditures.LocalShareUnpaidOblig AS TotalLocalShareUnpaidObligation,
Sum(tblGMISExpenditures.ProjectIncome) AS TotalOtherIncome,
Sum(tblGMISExpenditures.ForfeitureIncome) AS TotalForfIncome,
Sum(tblGMISExpenditures.OtherExpense) AS TotalOtherExpense,
Sum(tblGMISExpenditures.ForfeitureExpense) AS TotalForfExpense,
Sum(tblGMISExpenditures.InterestReceived) AS TotalIntReceived,
Sum(tblGMISExpenditures.Personnel) AS TotalPersonnel,
Sum(tblGMISExpenditures.ContractedServ) AS TotalContractedServ,
Sum(tblGMISExpenditures.Travel) AS TotalTravel,
Sum(tblGMISExpenditures.Equipment) AS TotalEquipment,
Sum(tblGMISExpenditures.Operating) AS TotalOperating,
Sum(tblGMISExpenditures.SecureDetention) AS TotalSecureDetention,
Sum(tblGMISExpenditures.SecureTransport) AS TotalSecureTrans,
Sum(tblGMISExpenditures.NonSecureDetention) AS TotalNonSecureDetention,
Sum(tblGMISExpenditures.ElectronicMonitor) AS TotalElectronicMonitor
FROM tblGMISExpenditures
GROUP BY tblGMISExpenditures.SubgrantIntID, tblGMISExpenditures.UnpaidOblig,
tblGMISExpenditures.LocalShareUnpaidOblig;


"Bob Barrows [MVP]" wrote:

> Jack wrote:
> > Hi,
> > Using a login userid, I am trying to go to a asp page which will
> > display the values for the particular record. The asp page has quite
> > a few recordsets in the form of Access stored query. Now for the
> > first recordset, I do not get an erro while for the second recordset,
> > I am getting an error message which i have attached here. I have no
> > idea why this is happening. I appreciate any help here. I am
> > attaching the two sets of code, the second one throws the error.
> > Thanks.
> >
> > RS.Open "Select * from GMISExpenseCombo1 where IntID = "& GrantID &
> > ";"
>
> The
> & ";"
> is totally unnecessary.
>
> >
> > RSTotalOutlay.Open "Select * from qryTotalOutlay1 where IntID = "&
> > GrantID & ";"
> >
> > ERROR MESSAGE:
> >
> > Microsoft OLE DB Provider for ODBC Drivers (0x80040E10)
> > [Microsoft][ODBC Microsoft Access Driver] Too few parameters.
> > Expected 1.
>
>
> This usually points to the use of a reserved keyword for a column or table
> name. Without seeing he sql of the saved query it's impossible to tell for
> sure. Here is a list of reserved keywords that need to be avoided when
> naming your database objects:
> http://www.aspfaq.com/show.asp?id=2080
>
> Show us the sql of the saved query if this does not get you going.
>
> HTH,
> Bob Barrows
>
> PS. You really should avoid "Select *" in your production code:
> http://www.aspfaq.com/show.asp?id=2096
>
> --
> Microsoft MVP -- ASP/ASP.NET
> Please reply to the newsgroup. The email account listed in my From
> header is my spam trap, so I don't check it very often. You will get a
> quicker response by posting to the newsgroup.
>
>
>

Re: opening same kind of recordset gives error for one while not f

am 28.12.2004 20:03:08 von jack

Hi Alistair,
Thanks for your help here. However, I do not have any spelling mistake as I
am using the stored Access query 'as is', which means, I am not even trying
to write the sql statement here. Thanks anyways.

"Alistair" wrote:

>
> "Jack" wrote in message
> news:96C8490C-BAC6-4740-AA5A-AE1198C8D7F4@microsoft.com...
> > Hi,
> > Using a login userid, I am trying to go to a asp page which will display
> > the
> > values for the particular record. The asp page has quite a few recordsets
> > in
> > the form of Access stored query. Now for the first recordset, I do not get
> > an
> > erro while for the second recordset, I am getting an error message which i
> > have attached here. I have no idea why this is happening. I appreciate any
> > help here. I am attaching the two sets of code, the second one throws the
> > error. Thanks.
> >
> > RS.Open "Select * from GMISExpenseCombo1 where IntID = "& GrantID & ";"
> >
> > RSTotalOutlay.Open "Select * from qryTotalOutlay1 where IntID = "& GrantID
> > &
> > ";"
> >
> > ERROR MESSAGE:
> >
> > Microsoft OLE DB Provider for ODBC Drivers (0x80040E10) [Microsoft][ODBC
> > Microsoft Access Driver] Too few parameters. Expected 1.
> >
> >
> >
>
> possible spelling mistake??..at least thats what I always have when I get
> that error message..
>
> have you tried a response.write?
>
>
>

Re: opening same kind of recordset gives error for one while not f

am 28.12.2004 20:30:52 von reb01501

Jack wrote:
> Hi Bob,
> I just checked the stored query GMISExpenseCombo1 and did not find any
> reserved word for any field. Since I cannot post the QBE format of
> the stored query, I am just sending the sql text format of the query

That's all I wanted.

> here. Thanks for your help and I am going to read the article on not
> using * in the select statment.
>

I thought it was the other query, qryTotalOutlay1, that was raising the
error ... Yes, here is what you said:
>>> here. I am attaching the two sets of code, the second one throws
>>> the error.

The second one was qryTotalOutlay1, so why post the sql of
GMISExpenseCombo1?

Bob Barrows

PS. You really should parmeterize those saved queries so you can avoid the
dynamic sql nonsense.
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.

Re: opening same kind of recordset gives error for one while not f

am 28.12.2004 20:47:05 von jack

Sorry, I screwed up. I am attaching the code of the second stored query here.
I know, I should stop the 'dynamic sql nonsense.' Probably, just need little
time to get to new habits. By the way, do you think in this scenario, I still
should use each of the field name in the table instead of the *. I just read
the article linked to your table. Here is the code. Thanks:

SELECT tblGMISExpenditures.SubgrantIntID,
Sum([Personnel]+[ContractedServ]+[Travel]+[Equipment]+[Opera ting]+[SecureDetention]+[SecureTransport]+[NonSecureDetentio n]+[ElectronicMonitor])
AS TotalOutlay, Sum(tblGMISExpenditures.LocalShare) AS TotalLocalOutlay,
tblGMISExpenditures.UnpaidOblig AS TotalUnpaidObligation,
tblGMISExpenditures.LocalShareUnpaidOblig AS TotalLocalShareUnpaidObligation,
Sum(tblGMISExpenditures.ProjectIncome) AS TotalOtherIncome,
Sum(tblGMISExpenditures.ForfeitureIncome) AS TotalForfIncome,
Sum(tblGMISExpenditures.OtherExpense) AS TotalOtherExpense,
Sum(tblGMISExpenditures.ForfeitureExpense) AS TotalForfExpense,
Sum(tblGMISExpenditures.InterestReceived) AS TotalIntReceived,
Sum(tblGMISExpenditures.Personnel) AS TotalPersonnel,
Sum(tblGMISExpenditures.ContractedServ) AS TotalContractedServ,
Sum(tblGMISExpenditures.Travel) AS TotalTravel,
Sum(tblGMISExpenditures.Equipment) AS TotalEquipment,
Sum(tblGMISExpenditures.Operating) AS TotalOperating,
Sum(tblGMISExpenditures.SecureDetention) AS TotalSecureDetention,
Sum(tblGMISExpenditures.SecureTransport) AS TotalSecureTrans,
Sum(tblGMISExpenditures.NonSecureDetention) AS TotalNonSecureDetention,
Sum(tblGMISExpenditures.ElectronicMonitor) AS TotalElectronicMonitor
FROM tblGMISExpenditures
GROUP BY tblGMISExpenditures.SubgrantIntID, tblGMISExpenditures.UnpaidOblig,
tblGMISExpenditures.LocalShareUnpaidOblig;


"Bob Barrows [MVP]" wrote:

> Jack wrote:
> > Hi Bob,
> > I just checked the stored query GMISExpenseCombo1 and did not find any
> > reserved word for any field. Since I cannot post the QBE format of
> > the stored query, I am just sending the sql text format of the query
>
> That's all I wanted.
>
> > here. Thanks for your help and I am going to read the article on not
> > using * in the select statment.
> >
>
> I thought it was the other query, qryTotalOutlay1, that was raising the
> error ... Yes, here is what you said:
> >>> here. I am attaching the two sets of code, the second one throws
> >>> the error.
>
> The second one was qryTotalOutlay1, so why post the sql of
> GMISExpenseCombo1?
>
> Bob Barrows
>
> PS. You really should parmeterize those saved queries so you can avoid the
> dynamic sql nonsense.
> --
> Microsoft MVP -- ASP/ASP.NET
> Please reply to the newsgroup. The email account listed in my From
> header is my spam trap, so I don't check it very often. You will get a
> quicker response by posting to the newsgroup.
>
>
>

Re: opening same kind of recordset gives error for one while not f

am 28.12.2004 21:40:54 von reb01501

Well, the first thing I see is that your dynamic sql statement is:
RSTotalOutlay.Open "Select * from qryTotalOutlay1 where IntID = "& GrantID

And I don't see an IntID field in your saved query's sql. I see
SubgrantIntID, but not IntID

> SELECT tblGMISExpenditures.SubgrantIntID,


Jack wrote:
> Sorry, I screwed up. I am attaching the code of the second stored
> query here. I know, I should stop the 'dynamic sql nonsense.'
> Probably, just need little time to get to new habits. By the way, do
> you think in this scenario, I still should use each of the field name
> in the table instead of the *.

Yes. I'm talking about your dynamic sql statement, which should list all the
fields you want to retrieve, instead of willy-nilly retrieving all of them

Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.

Re: opening same kind of recordset gives error for one while not f

am 28.12.2004 22:07:04 von jack

Bob, it works now with the change. It was just a 'major help'. Thanks for
your generous help and advise too.

"Bob Barrows [MVP]" wrote:

> Well, the first thing I see is that your dynamic sql statement is:
> RSTotalOutlay.Open "Select * from qryTotalOutlay1 where IntID = "& GrantID
>
> And I don't see an IntID field in your saved query's sql. I see
> SubgrantIntID, but not IntID
>
> > SELECT tblGMISExpenditures.SubgrantIntID,
>
>
> Jack wrote:
> > Sorry, I screwed up. I am attaching the code of the second stored
> > query here. I know, I should stop the 'dynamic sql nonsense.'
> > Probably, just need little time to get to new habits. By the way, do
> > you think in this scenario, I still should use each of the field name
> > in the table instead of the *.
>
> Yes. I'm talking about your dynamic sql statement, which should list all the
> fields you want to retrieve, instead of willy-nilly retrieving all of them
>
> Bob Barrows
> --
> Microsoft MVP -- ASP/ASP.NET
> Please reply to the newsgroup. The email account listed in my From
> header is my spam trap, so I don't check it very often. You will get a
> quicker response by posting to the newsgroup.
>
>
>