Hello
I am not getting a response from the .Recordcount in ADODB.Recordset
It opens the file ok and you can see the first record but the .Recordcount
shows -1
Help Please
Set rsEmail_BusinessType = New ADODB.Recordset
rsEmail_BusinessType.Open "Email_BusinessType_Table", ConStr_For_EmailData,
adOpenStatic, adLockOptimistic, adCmdTable
With rsEmail_BusinessType
.MoveFirst
If .RecordCount > 0 Then
Do Until .EOF = True
Combo1.AddItem !BusinessType
.MoveNext
Loop
End If
End With
rsEmail_BusinessType.Close
Set rsEmail_BusinessType = Nothing
Dmitriy Antonov - 14 Apr 2008 02:24 GMT
RecordCount doesn't work with all types of cursor. Generally it works with
ClientSide Static cursor. This is officially documented in the ADO Help.
In your particular case you can just remove If statement at all, which is
just superfluous, and it will work as expected. BTW you should remove
MoveFirst because the recordset after opening is always positioned at the
first record, if any exists. Otherwise you should use a check
if not (.eof and .bof) then .MoveFirst
If you don't do it this way you will have an error if there are no records.
Dmitriy.
> Hello
> I am not getting a response from the .Recordcount in ADODB.Recordset
[quoted text clipped - 18 lines]
> rsEmail_BusinessType.Close
> Set rsEmail_BusinessType = Nothing