Can't use RecordSet 
Author Message
 Can't use RecordSet

Below is the code from a test application.  I'm getting a Run Time 91
error when the line with the recordset is processed.  The error says
object variable or With block variable not set.  This code is from a
help example, so it should run.  Any ideas?

The form has a data control (Data1), and the flexgrid.

Thanks,

' General Declarations
Option Explicit

' Data1 Validate
Private Sub Data1_Validate(Action As Integer, Save As Integer)

End Sub

' Form Load
Private Sub Form_Load()
Data1.DatabaseName = "C:\Program Files\Microsoft Visual
Studio\FS5\FS.mdb"
Data1.RecordSource = "SELECT [NetName] FROM subnetwork"
Data1.Recordset.MoveLast ' Gives 91 error code.

End Sub

' MSFlexGrid1 Click
Private Sub MSFlexGrid1_Click()

End Sub



Sun, 18 Nov 2001 03:00:00 GMT  
 Can't use RecordSet

Quote:
>I'm getting a Run Time 91
>error when the line with the recordset is processed.  The error says
>object variable or With block variable not set.  This code is from a
>help example, so it should run.  Any ideas?

>The form has a data control (Data1), and the flexgrid.

>Thanks,

>' General Declarations
>Option Explicit

>' Data1 Validate
>Private Sub Data1_Validate(Action As Integer, Save As Integer)

>End Sub

>' Form Load
>Private Sub Form_Load()
>Data1.DatabaseName = "C:\Program Files\Microsoft Visual
>Studio\FS5\FS.mdb"
>Data1.RecordSource = "SELECT [NetName] FROM subnetwork"
>Data1.Recordset.MoveLast ' Gives 91 error code.

>End Sub

>' MSFlexGrid1 Click
>Private Sub MSFlexGrid1_Click()

>End Sub

Try doing a "Data1.Refresh" just before the line with the error.

Another Dennis :-)



Sun, 18 Nov 2001 03:00:00 GMT  
 Can't use RecordSet
do a .Refresh before the .MoveLast.  search VB Help on "Refresh" to get the
specifics on why it is necessary... :)

good luck!


--


Quote:
> Below is the code from a test application.  I'm getting a Run Time 91
> error when the line with the recordset is processed.  The error says
> object variable or With block variable not set.  This code is from a
> help example, so it should run.  Any ideas?

> The form has a data control (Data1), and the flexgrid.

> Thanks,

> ' General Declarations
> Option Explicit

> ' Data1 Validate
> Private Sub Data1_Validate(Action As Integer, Save As Integer)

> End Sub

> ' Form Load
> Private Sub Form_Load()
> Data1.DatabaseName = "C:\Program Files\Microsoft Visual
> Studio\FS5\FS.mdb"
> Data1.RecordSource = "SELECT [NetName] FROM subnetwork"
> Data1.Recordset.MoveLast ' Gives 91 error code.

> End Sub

> ' MSFlexGrid1 Click
> Private Sub MSFlexGrid1_Click()

> End Sub



Sun, 18 Nov 2001 03:00:00 GMT  
 Can't use RecordSet
You are doing fine, hoewever you need to insert the line data1.refresh to
run the query, before you can go to a certain record in the control
Vincent


Quote:
> Below is the code from a test application.  I'm getting a Run Time 91
> error when the line with the recordset is processed.  The error says
> object variable or With block variable not set.  This code is from a
> help example, so it should run.  Any ideas?

> The form has a data control (Data1), and the flexgrid.

> Thanks,

> ' General Declarations
> Option Explicit

> ' Data1 Validate
> Private Sub Data1_Validate(Action As Integer, Save As Integer)

> End Sub

> ' Form Load
> Private Sub Form_Load()
> Data1.DatabaseName = "C:\Program Files\Microsoft Visual
> Studio\FS5\FS.mdb"
> Data1.RecordSource = "SELECT [NetName] FROM subnetwork"
> Data1.Recordset.MoveLast ' Gives 91 error code.

> End Sub

> ' MSFlexGrid1 Click
> Private Sub MSFlexGrid1_Click()

> End Sub



Mon, 19 Nov 2001 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. 'Canned' data in VB program

2. ADODB.recordset filter problem using 'AND'

3. Using a recordset as a report's datasource

4. Opening second recordset on the same table using DAO in Access '97

5. Can't get Sorted Recordset using Query

6. Can't get recordset to populate datagrid using Access

7. ADO or DataEnvironment COMMAND Using Store procedure can't return recordset

8. Can't reset commandtext for recordset in dataenvironment using ADo

9. ADO Recordset's strange behaviour when filtered using adFilterConflictingRecords

10. Can't return a disconnected recordset using Commands

11. ADO or DataEnvironment COMMAND Using Store procedure can't return recordset

12. Opened Recordsets don't show up in Recordsets Collection

 

 
Powered by phpBB® Forum Software