LittleSmudge
Programmer
I have a Linking table that has three ForeignKey fields
( All three together make a conbined PK )
The three fields are
ListRef
PersonRef
KeywordRef
I need the total number of records in the table where KeywordRef = {data}
Ie( SELECT Count(Keywordref) FROM tblListKeyWords WHERE KeyWordRef = 'data' )
I also need the number of different PersonRef values in the above list
Ie ( SELECT Count(PersonRef) As CofP FROM tblListKeyWords WHERE KeyWordRef = 'data' GROUP BY PersonRef )
Ideally I'd like to combine these in a single shot - but whatever I try doesn't seem to want to work
I've got to
At the rst.EOF line I get an error message < Operation is not allowed when the object is closed >
Can anyone see what I'm doing wrong - or suggest an easier path ?
I think this is a '.. .. wood for the trees' problem, I've been staring at it for too long.
G LS
spsinkNOJUNK@yahoo.co.uk
Remove the NOJUNK to use.
( All three together make a conbined PK )
The three fields are
ListRef
PersonRef
KeywordRef
I need the total number of records in the table where KeywordRef = {data}
Ie( SELECT Count(Keywordref) FROM tblListKeyWords WHERE KeyWordRef = 'data' )
I also need the number of different PersonRef values in the above list
Ie ( SELECT Count(PersonRef) As CofP FROM tblListKeyWords WHERE KeyWordRef = 'data' GROUP BY PersonRef )
Ideally I'd like to combine these in a single shot - but whatever I try doesn't seem to want to work
I've got to
Code:
Dim rst As ADODB.Recordset
On Error GoTo Err_UpdateCounters
Set rst = New ADODB.Recordset
rst.CursorType = adOpenKeyset
rst.LockType = adLockOptimistic
rst.ActiveConnection = CurrentProject.Connection
rst.Open "SELECT Count(RecordRef) As CountOfUsers, " _
& "Sum(NoOfUsers) As CountOfPlaces " _
& "FROM (SELECT RecordRef, Count(RecordRef) As NoOfUsers " _
& "FROM tblListKeyword WHERE KeyWordRef = '" & strData & "' " _
& "GROUP By RecordRef) As tmp "
If rst.EOF Then
At the rst.EOF line I get an error message < Operation is not allowed when the object is closed >
Can anyone see what I'm doing wrong - or suggest an easier path ?
I think this is a '.. .. wood for the trees' problem, I've been staring at it for too long.
G LS
spsinkNOJUNK@yahoo.co.uk
Remove the NOJUNK to use.