OKAY. This is probably really really simple:
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:
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 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: