2 questions: rst.recordcount & verify docmd.sendobject

SamDeMan

Registered User.
Local time
Today, 08:29
Joined
Aug 22, 2005
Messages
182
Hi

I read the help files a few times, and i don't understand why my recordcount in ado recordsets return -1. basically i run in to the problem of knowing whether the recordset has opened. what am i doing wrong?

also, i would like to verify if the docmd.sendobject excuted. basically i send some stuff to outlook, and i set Edit Message= true. i would like that the user can click away to something else, and more importantly, cancel the email with out causing some error. in other words i would like to do this:
DidISend = docmd.sendObject( etc...
however, this doesn't work. what can i do?

thanks,

sam
 
SamDeMan said:
Hi
I read the help files a few times, and i don't understand why my recordcount in ado recordsets return -1. basically i run in to the problem of knowing whether the recordset has opened. what am i doing wrong?

Not all cursortypes support a record count so be sure to use the adOpenKeyset cursor...

Code:
Dim rst as new adodb.recordset
    With Rst
        .ActiveConnection = CurrentProject.Connection
        .LockType = adLockReadOnly
        .CursorType = [B]adOpenKeyset[/B]
        .Source = "SELECT * FROM tablename"
        .Open
        Msgbox "Number of recs " & .RecordCount
    End With
rst.close
set rst = nothing

Regards,
Tim
 
If it is anything like DAO then linked tables return -1 for RecordCount until you have done a .MoveLast.
 
thanks guys, i will try "pono1" method. ruralguy - i think i tried that, but i didn't support the .movelast either. ( iwill try again).

anybody know about the second question? should i use outlook automation instead? i think i read that somewhere.

thanks,

sam
 
pono1 - adding adOpenKeyset helped.

thanks bro,

sam
 

Users who are viewing this thread

Back
Top Bottom