Information générale
Catégorie:
Bases de données DAO/RDO/ODBC/ADO
Titre:
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
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement