Re: Check on empty record set in VBA
- From: "lylefair" <lylefair@xxxxxxxx>
- Date: 23 Sep 2005 21:35:12 -0700
Yes, I find no reason to use BOF.
But RecordCount is returned from Static as well as KeySet Cursor
types.
Complicating this, at least here in Canader, is that no matter to what
value we set the CursorType, when we open a recordset using
CurrentProject.Connection or CurrentProject.AccessConnection it is
always opened as adOpenStatic (3), thus always allowing for RecordCount
to be returned.
Perhaps others can confirm this, so that we will not attribute it to
some error here.
(with something like this air code):
Sub test()
Dim c As ADODB.Connection
Dim r As ADODB.Recordset
Set c = New ADODB.Connection
c.Open CurrentProject.BaseConnectionString & ";USER
ID=USERID;PASSWORD=PASSWORD"
Set r = New ADODB.Recordset
With r
..CursorType = adOpenForwardOnly '0
..Open "SELECT * FROM FFDBATransactions", CurrentProject.Connection
MsgBox .CursorType
MsgBox .RecordCount
..Close
..CursorType = adOpenForwardOnly '0
..Open "SELECT * FROM FFDBATransactions", c
MsgBox .CursorType
MsgBox .RecordCount
..Close
End With
End Sub
.
- Follow-Ups:
- Re: Check on empty record set in VBA
- From: David W. Fenton
- Re: Check on empty record set in VBA
- References:
- Check on empty record set in VBA
- From: S. van Beek
- Re: Check on empty record set in VBA
- From: David W. Fenton
- Re: Check on empty record set in VBA
- From: lylefair
- Re: Check on empty record set in VBA
- From: David W. Fenton
- Re: Check on empty record set in VBA
- From: Bob Quintal
- Re: Check on empty record set in VBA
- From: Trevor Best
- Re: Check on empty record set in VBA
- From: Randy Harris
- Check on empty record set in VBA
- Prev by Date: Re: Check on empty record set in VBA
- Next by Date: OLAP Problems in Windows Environment
- Previous by thread: Re: Check on empty record set in VBA
- Next by thread: Re: Check on empty record set in VBA
- Index(es):
Relevant Pages
|