General information
Category:
Database DAO/RDO/ODBC/ADO
Title:
ADO Recordset as a Parameter
Maybe this is an easy question. I hope I'm just not pulling a no-brainer here...
I'm writing a COM Object to help compile item information from many different, related tables in a database. I want to pass in a blank ADO Recordset object into a FUNCTION, and within the function, populate that recordset.
My FUNCTION definition is:
--------Snip--------
Public Function GetCategory(ByVal Catalog As String, _
ByRef rsCategory As ADODB.Recordset) As Boolean
--------Snip--------
The routine that I use to call this function is:
--------Snip--------
Private Sub cmdGetCategory_Click()
Dim objCategory As ECommerce.GetItem
Dim rstCategory As ADODB.Recordset
Dim blnReturn As Boolean
blnReturn = objCategory.GetCategory( _
Trim(txtCatalog.Text), rstCategory)
If blnReturn Then
dbgRecordset.DataSource = rstCategory
dbgRecordset.Refresh
End If
End Sub
--------Snip--------
Of course, I get an "Object Variable or With block variable not set." error when I run this because the "rstCategory" is equal to Nothing. How can I pass in a blank ADO Recordset object, or is this not possible?
Thanks.
-Joe
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only