Quantcast
Channel: dBforums – Everything on Databases, Design, Developers and Administrators
Viewing all articles
Browse latest Browse all 13329

cmd.Execute not filling recordset

$
0
0
OKAY. This is probably really really simple:

Code:

Set conn = CurrentProject.Connection
   
    Set cmd = New ADODB.Command
    Set cmd.ActiveConnection = conn
    With cmd
        .Properties("Jet OLEDB:Stored Query") = True
        .CommandText = "qryDATAMAP-ALL"
    End With
   
    Set rst = New ADODB.RecordSet
    Set rst = cmd.Execute()
   
    Debug.Print rst.RecordCount

I don't know why but this thing is returning -1 for record count.

I use almost this exact same code in a function I wrote for an Excel workbook, and it works FLAWLESSLY when I'm connecting to the database externally. But, when I do it internally, I can't seem to pull any records from this query.

That query name is RIGHT by golly. Please, someone slap me upside the head with a fish and jog the probably obvious answer loose from my brain.

Thanks :eek:

Viewing all articles
Browse latest Browse all 13329

Trending Articles