J
james_keegan via AccessMonster.com
Hey folks - I'm lost and confused (again!)
I've got a linked spreadsheet as a table.
I've created a recordset reference to that table in my VB code
I'm trying to do a 'dcount' function on that recordset.
But I keep getting a run time error #3078 'ms jet can't find' the named
recordset.
Here's the salient parts of the code in question:
***
Private Sub btnFindRe_Enrollees_Click()
...
Dim tblNewEnrollees As Recordset
Dim tblPrevLines As Recordset
Dim CurCin As String, sqlstring As String
Dim r As Integer, cincount As Integer, reccount As Integer
...
Set tblPrevLines = CurrentDb.OpenRecordset("MMC-FHP-previousline")
Set tblNewEnrollees = CurrentDb.OpenRecordset("MMC-FHP-combined-roster")
...
CurCin = tblNewEnrollees![CIN PC]
reccount = DCount("[CIN PC]", "tblPrevLines", "[CIN PC] =" & CurCin)
...
end sub
***
Is there some other way I can do domain aggregate functions (or sql functions)
against a linked spreadsheet as a recordset in VBA? Or am I screwing up
something obvious?
I found I could do this the 'hard way' by looping through the tblPrevLines
and counting, but isn't there a way to make the domain aggregate functions
work? What I'm really trying to do is to do a make table query against the
PrevLines table selecting only those records where the [CIN PC] field match
the 'CurCin' variable. But I figured if I could get the domain aggregate
functions working, then the SQL functions would work too since they both rely
on Jet.
Any clues would be gratefully appreciated.
Thanks.
jk
I've got a linked spreadsheet as a table.
I've created a recordset reference to that table in my VB code
I'm trying to do a 'dcount' function on that recordset.
But I keep getting a run time error #3078 'ms jet can't find' the named
recordset.
Here's the salient parts of the code in question:
***
Private Sub btnFindRe_Enrollees_Click()
...
Dim tblNewEnrollees As Recordset
Dim tblPrevLines As Recordset
Dim CurCin As String, sqlstring As String
Dim r As Integer, cincount As Integer, reccount As Integer
...
Set tblPrevLines = CurrentDb.OpenRecordset("MMC-FHP-previousline")
Set tblNewEnrollees = CurrentDb.OpenRecordset("MMC-FHP-combined-roster")
...
CurCin = tblNewEnrollees![CIN PC]
reccount = DCount("[CIN PC]", "tblPrevLines", "[CIN PC] =" & CurCin)
...
end sub
***
Is there some other way I can do domain aggregate functions (or sql functions)
against a linked spreadsheet as a recordset in VBA? Or am I screwing up
something obvious?
I found I could do this the 'hard way' by looping through the tblPrevLines
and counting, but isn't there a way to make the domain aggregate functions
work? What I'm really trying to do is to do a make table query against the
PrevLines table selecting only those records where the [CIN PC] field match
the 'CurCin' variable. But I figured if I could get the domain aggregate
functions working, then the SQL functions would work too since they both rely
on Jet.
Any clues would be gratefully appreciated.
Thanks.
jk