Re: Multiple recordsets?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



I think I've overcame this in that I added the following line of code which
now gets the full RecordCount.

mySourceConn.CursorLocation = adUseClient


Thanks again guys. Take cares :)


"zz12" <IDontLikeSpam@xxxxxxxxxxx> wrote in message
news:OQ8jeZpjHHA.4848@xxxxxxxxxxxxxxxxxxxxxxx
That worked :)

Now that it's working just one other small issue that I'm encountering if
I may is that I'm trying to use the following:

For countr = 1 To mySourceRecordset.RecordCount

but it only performs my process on just the first record and then doesn't
loop since the RecordCount is coming up as -1.

I tried using the MoveLast and MoveFirst but it gives me an error message
"Rowset does not support fetching backward.". I also tried changing the
CursorType to some of the other ones but it still doesn't allow the
MoveLast/MoveFirst or get the full RecordCount.

mySourceRecordset.Open mySQLCmdText, mySourceConn, adOpenKeyset

Do you know if I should be using a different CursorType or another method
in getting the full RecordCount?

Thank you both for your replies. I totally appreciate it.




"Bob Butler" <noway@xxxxxxxxxxx> wrote in message
news:%23rRVJKojHHA.2272@xxxxxxxxxxxxxxxxxxxxxxx
"zz12" <IDontLikeSpam@xxxxxxxxxxx> wrote in message
news:OrRCD6mjHHA.3452@xxxxxxxxxxxxxxxxxxxxxxx
If mySourceRecordset.RecordCount < 1 Then

Ralph's link is good but you may alo be getting RecordCount of -1 due to
the cursorlocation and other properties; try

If mySourceRecordSet.EOF Then





.



Relevant Pages

  • Re: VB6 - ADODB - Strange behavior between IDE & EXE
    ... it mentions that RecordCount may return -1 for unsupported CursorType. ... However, this CursorType usage had been working for years, particularly with Access and Sybase ASE, on Windows 2000 and XP. ... It appears that the rs object itself is now reflecting some other object than that I set in the given LostFocus event. ... If iAns = vbYes Then ...
    (microsoft.public.vb.database.ado)
  • Re: rs.PageCount cannot function
    ... Before open, using stored procedure executed via dynamic sql, cursortype = 3 ... Before open, using stored procedure executed via Command object, cursortype ... So, even though it's giving us the "right" cursortype, the recordcount is ... This email account is my spam trap so I ...
    (microsoft.public.inetserver.asp.db)
  • Re: Embedded SQL within VBA?
    ... If you can't MoveLast, then the provider you are using probably defaults to using an "adOpenForwardOnly" cursortype (you can use the CursorType parameter of the Open method to try to specify the CursorType, but the provider may change the type if it doesn't support the one you asked for. ... If you have an adOpenForwardONly cursor type, try changing it to any of the others - if you need to be able to update the recordset, use adOpenDynamic or adOpenKeyset, otherwise you may be able to use adOpenStatic. ... figure out why .RecordCount is returning -1 here? ...
    (microsoft.public.word.vba.general)
  • Re: RecordCount error
    ... Set cursorType to adOpenStatic and see if that helps. ... RecordCount returns -1 ... rsRecCount = rsPatient.RecordCount ...
    (microsoft.public.vb.database.ado)
  • Re: RecordCount error
    ... Set cursorType to adOpenStatic and see if that helps. ... RecordCount returns -1 ... Microsoft MVP Scripting and ADSI ... rsRecCount = rsPatient.RecordCount ...
    (microsoft.public.vb.database.ado)