Help--"Command text was not set for the command object"

D

David Wetmore

I have a code module for a "descriptorset" object.
In the general declarations section of this object I have:
Private mrstUtility As ADODB.Recordset

I've written and am using several methods, but I have a bug in a debugging routine.

The routine is:

Public Sub SelectorSetInfo()
Debug.Print "+++++++++++++++++SELECTOR SET INFO++++++++++++++++++++++++++++"
Debug.Print "Number of Descriptors: " & CStr(mrstUtility.RecordCount)
Debug.Print "Total Number Unselected (Flag 0): " & GroupTotal(0)
Debug.Print "Total Number Selected (Flag 1): " & GroupTotal(1)
Debug.Print
End Sub 'SelectorSetInfo

In the code for a form I have:

Dim AllRecords as DescriptorSet
and, later
Set AllRecords = New DescriptorSet
still later I have
AllRecords.SelectorSetInfo

I get a run-time error when this code gets to the SelectorSetInfo routine.
It halts when it encounters "mrstUtility.RecordCount"
with the Error Message "Command text was not set for the command object".

Where have I gone wrong?
 
D

David Wetmore

In the initialize routine for the object I have:

Set mrstUtility = New ADODB.Recordset
mrstUtility.ActiveConnection = CurrentProject.Connection
 
D

David Wetmore

I told you where I declared it.
For some reason I had carefully commented out the instantiation.
I noticed it when I read ALL my code.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top