-
Query Count ADO
Hi all,
I want to pull data from a query in my MS access database into a a cell on an Excel spread sheet. The query that I use has one field and has the Total property set to the "Count" type.
The following is my connection to the .mdb file... from Excel. I have the name of the count field set, exactly as its generated by MS Access. I get the error: "Runtime Error - 3265"
"The Item cannot be found in the collection corresponding to the requested name or ordinal ."
Code:
Option Explicit
Const dbFullName As String = "C:\Documents and Settings\Larry.Bargers\Desktop\CompTesting.mdb"
Private Sub Worksheet_Activate()
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Set cn = New ADODB.Connection
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & dbFullName & ";" & _
"Jet OLEDB:Database Password=RCAT;"
Set rs = New ADODB.Recordset
rs.Open "qryUniqueOpenIssues", cn, adOpenDynamic, adLockOptimistic, adCmdTable
rs.MoveFirst
Me.Cells(3, 4) = rs![countOfTest/Advisory] 'I get the error when this line is read in...
rs.Close
End Sub
Thanks for any help..
Larry
-
Re: Query Count ADO
I think you have change your source:
Code:
rs.open "SELECT * FROM qryUniqueOpenIssues", cn....
-
Re: Query Count ADO
Your right Sabin.. the query was incorrect... Thanks..
Larry