| | |
|
|
|
Reordcount = -1 |
| message from George Hester on 27 May 2004 |
http://support.microsoft.com/default.aspx?scid=3Dkb;en-us;248255
I just put one command button on a form and this is the code for the =
Click event:
Private Sub Command1_Click()
Dim rs As ADODB.Recordset
Set rs =3D New ADODB.Recordset
=20
Dim rec As ADODB.Record
Set rec =3D New ADODB.Record
=20
Dim stm As ADODB.Stream
Set stm =3D New ADODB.Stream
'Specify adCmdTableDirect when opening a document or folder
rs.Open "test.txt", "Provider=3DMSDAIPP.DSO;" & _=20
"Data Source=3Dhttp://localhost/test", _
adOpenForwardOnly, adLockReadOnly, adCmdTableDirect
Debug.Print rs.RecordCount
End Sub
There are no reords. At least that is what the result -1 is telling me =
I think. What's wrong?
Thanks.
|
| MyndPhlyp replied to George Hester on 27 May 2004 |
In this example:
http://support.microsoft.com/default.aspx?scid=kb;en-us;248255
I just put one command button on a form and this is the code for the Click
event:
Private Sub Command1_Click()
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
Dim rec As ADODB.Record
Set rec = New ADODB.Record
Dim stm As ADODB.Stream
Set stm = New ADODB.Stream
'Specify adCmdTableDirect when opening a document or folder
rs.Open "test.txt", "Provider=MSDAIPP.DSO;" & _
"Data Source=http://localhost/test", _
adOpenForwardOnly, adLockReadOnly, adCmdTableDirect
Debug.Print rs.RecordCount
End Sub
There are no reords. At least that is what the result -1 is telling me I
think. What's wrong?
Thanks.
.RecordCount doesn't indicate how many records are contained in a dynaset-,
snapshot-, or forward-only-type Recordset object until all records have been
accessed. Once the last record has been accessed, the RecordCount property
indicates the total number of undeleted records in the Recordset or TableDef
object. To force the last record to be accessed, use the .MoveLast method on
the Recordset object.
|
| George Hester replied to MyndPhlyp on 27 May 2004 |
rs.Open "test.txt", "Provider=3DMSDAIPP.DSO;" & _
"Data Source=3Dhttp://localhost/test", _
adOpenForwardOnly, adLockReadOnly, adCmdTableDirect
rs.MoveLast
Debug.Print rs.RecordCount
the result was:
Run-time error '-2147217884 (80040e24) at rs.MoveLast
Looks like there are no records in the recordset. Did I miss something? =
Thanks.
|
| MyndPhlyp replied to George Hester on 27 May 2004 |
Thanks for the input. I did this:
rs.Open "test.txt", "Provider=MSDAIPP.DSO;" & _
"Data Source=http://localhost/test", _
adOpenForwardOnly, adLockReadOnly, adCmdTableDirect
rs.MoveLast
Debug.Print rs.RecordCount
the result was:
Run-time error '-2147217884 (80040e24) at rs.MoveLast
Looks like there are no records in the recordset. Did I miss something?
Thanks.
See if this sheds some light on the subject:
http://support.microsoft.com/default.aspx?scid=kb;en-us;245359
Looking at the Recordset Object section, I noticed a couple of the .Open
parameters are left blank. That might be part of the problem. (Defaults are
sometimes good things.)
Does "test.txt" exist in the "test" subdirectory of "localhost's" web? Since
you're going after "localhost", it's right there on your machine.
|
| George Hester replied to MyndPhlyp on 27 May 2004 |
Yes the state of the connect =3D 1. =20
rs.State =3D 1
I'll check out that link thanks.
|
| George Hester replied to George Hester on 27 May 2004 |
OK whittled it down to this. None of the examples that Microsoft =
presents that include adCmdTableDirect will work. Actually it doesn't =
matter. It turns out for this to be used I have to allow file browsing. =
Since that's not going to happen on to the next idea. The reason for =
this is I wanted to read a OLE Object put it in a disconnected Recordset =
and then pop it into a database that is ready for it. Believe it or not =
this could have worked. At least I think so.
|
|
Archived message: Reordcount = -1 (MS Access Database)