ADO-Problems w. Recordset.Open method 
Author Message
 ADO-Problems w. Recordset.Open method

I'm simply trying to open a recordset using a string variable that holds an
SQL query.  I'm not using a Command object, but I don't think I have to.  My
connection object is declared globally in my SubMain.  Here's my code:

                dim strSQL as String
                strSQL = "  SQL statement........ "
                recRecordSet.Open strSQL, gconDB, adOpenForwardOnly,
                        AdLockReadOnly, adCommandText

When I try to run the project, I get the error:  "No value given for 1 or
more
required parameters".  What in the world am I missing????  I do not see a
problem!!  Please help!!



Mon, 23 Dec 2002 03:00:00 GMT  
 ADO-Problems w. Recordset.Open method
Hi Mike.

Try to open the recordset without the "adCommandText" parameter,so that the
VB statement looks like this:

    rst.Open strSQL, gconDB, adOpenForwardOnly, AdLockReadOnly

Hope this helps.

Bruce

Quote:

>I'm simply trying to open a recordset using a string variable that holds an
>SQL query.  I'm not using a Command object, but I don't think I have to.
My
>connection object is declared globally in my SubMain.  Here's my code:

>                dim strSQL as String
>                strSQL = "  SQL statement........ "
>                recRecordSet.Open strSQL, gconDB, adOpenForwardOnly,
>                        AdLockReadOnly, adCommandText

>When I try to run the project, I get the error:  "No value given for 1 or
>more
>required parameters".  What in the world am I missing????  I do not see a
>problem!!  Please help!!



Tue, 24 Dec 2002 03:00:00 GMT  
 ADO-Problems w. Recordset.Open method


Quote:
>I'm simply trying to open a recordset using a string variable that holds an
>SQL query.  I'm not using a Command object, but I don't think I have to.
My
>connection object is declared globally in my SubMain.  Here's my code:

>                dim strSQL as String
>                strSQL = "  SQL statement........ "
>                recRecordSet.Open strSQL, gconDB, adOpenForwardOnly,
>                        AdLockReadOnly, adCommandText

>When I try to run the project, I get the error:  "No value given for 1 or
>more
>required parameters".  What in the world am I missing????  I do not see a
>problem!!  Please help!!

Can you post the SQL? From my experience I'd say there's
something wrong with that.

Regards
Kurt



Tue, 24 Dec 2002 03:00:00 GMT  
 ADO-Problems w. Recordset.Open method
Sure, here's the SQL statement and thanks in advance for your help:

strSQL = "SELECT Title FROM tblClassDetail " _
           & " WHERE tblClassDetail.ClassNo = " _
           & " Left(frmAnswerQuestionaire.dbcboClassNumber.Text,7)"


Quote:


> >I'm simply trying to open a recordset using a string variable that holds
an
> >SQL query.  I'm not using a Command object, but I don't think I have to.
> My
> >connection object is declared globally in my SubMain.  Here's my code:

> >                dim strSQL as String
> >                strSQL = "  SQL statement........ "
> >                recRecordSet.Open strSQL, gconDB, adOpenForwardOnly,
> >                        AdLockReadOnly, adCommandText

> >When I try to run the project, I get the error:  "No value given for 1 or
> >more
> >required parameters".  What in the world am I missing????  I do not see a
> >problem!!  Please help!!

> Can you post the SQL? From my experience I'd say there's
> something wrong with that.

> Regards
> Kurt



Tue, 24 Dec 2002 03:00:00 GMT  
 ADO-Problems w. Recordset.Open method
On Thu, 6 Jul 2000 11:42:21 -0400, "Mike Carol"

Unless you are setting references to your database and the recordset
elsewhere this is the reason.

First of all, a reference to an Object Library (ADO or DAO) must be
set in Project references.

Then within the code you must set a reference to the database
variable.

Set myDB = OpenDatabase("myDatabaseNAme", Options)

Set  recRecordSet = myDB.OPenRecordset(strSQL, gconDB,
adOpenForwardOnly)

Now you have the reference to your Recordset and can manipulate the
data within it.

Sol.

Quote:
>I'm simply trying to open a recordset using a string variable that holds an
>SQL query.  I'm not using a Command object, but I don't think I have to.  My
>connection object is declared globally in my SubMain.  Here's my code:

>                dim strSQL as String
>                strSQL = "  SQL statement........ "
>                recRecordSet.Open strSQL, gconDB, adOpenForwardOnly,
>                        AdLockReadOnly, adCommandText

>When I try to run the project, I get the error:  "No value given for 1 or
>more
>required parameters".  What in the world am I missing????  I do not see a
>problem!!  Please help!!



Wed, 25 Dec 2002 03:00:00 GMT  
 ADO-Problems w. Recordset.Open method
On Thu, 6 Jul 2000 11:42:21 -0400, "Mike Carol"

Unless you are setting references to your database and the recordset
elsewhere this is the reason.

First of all, a reference to an Object Library (ADO or DAO) must be
set in Project references.

Then within the code you must set a reference to the database
variable.

Set myDB = OpenDatabase("myDatabaseNAme", Options)

Set  recRecordSet = myDB.OPenRecordset(strSQL, gconDB,
adOpenForwardOnly)

Now you have the reference to your Recordset and can manipulate the
data within it.

Sol.

Quote:
>I'm simply trying to open a recordset using a string variable that holds an
>SQL query.  I'm not using a Command object, but I don't think I have to.  My
>connection object is declared globally in my SubMain.  Here's my code:

>                dim strSQL as String
>                strSQL = "  SQL statement........ "
>                recRecordSet.Open strSQL, gconDB, adOpenForwardOnly,
>                        AdLockReadOnly, adCommandText

>When I try to run the project, I get the error:  "No value given for 1 or
>more
>required parameters".  What in the world am I missing????  I do not see a
>problem!!  Please help!!



Sat, 28 Dec 2002 03:00:00 GMT  
 ADO-Problems w. Recordset.Open method
On Fri, 7 Jul 2000 20:59:59 -0400, "Mike Carol"

Your last part of the strSQL is interpreted literally because it is
enclosed in quotations.

strSQL = "SELECT Title FROM tblClassDetail " _
           & " WHERE tblClassDetail.ClassNo = " _
           & " Left(frmAnswerQuestionaire.dbcboClassNumber.Text,7)"

Change it to:

strSQL = "SELECT Title FROM tblClassDetail " _
           & " WHERE tblClassDetail.ClassNo = " _
           &  Left(frmAnswerQuestionaire.dbcboClassNumber.Text,7)

Sol.

Quote:



>> >I'm simply trying to open a recordset using a string variable that holds
>an
>> >SQL query.  I'm not using a Command object, but I don't think I have to.
>> My
>> >connection object is declared globally in my SubMain.  Here's my code:

>> >                dim strSQL as String
>> >                strSQL = "  SQL statement........ "
>> >                recRecordSet.Open strSQL, gconDB, adOpenForwardOnly,
>> >                        AdLockReadOnly, adCommandText

>> >When I try to run the project, I get the error:  "No value given for 1 or
>> >more
>> >required parameters".  What in the world am I missing????  I do not see a
>> >problem!!  Please help!!

>> Can you post the SQL? From my experience I'd say there's
>> something wrong with that.

>> Regards
>> Kurt



Sat, 28 Dec 2002 03:00:00 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. ADO recordset.open method

2. ADO Method Open recordset Error !!!

3. Open ADO recordset on another ADO recordset - possible?

4. Problem with Recordset's Open Method

5. Problem with ADO Recordset AddNew method

6. Problem using the .Find Method for Recordset in ADO Control

7. ADO Recordset Find method Problem

8. Problem opening recordset for update ADO 2.1/Jet 4.0/Access 2000 stored proc

9. ADO Open recordset problem

10. ADO Recordset .OPEN problem

11. ADO Open Recordset problem

12. Problem with SQL on ADO Recordset Open

 

 
Powered by phpBB® Forum Software