Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

function return recordset? 1

Status
Not open for further replies.

imarosel

Technical User
Jun 23, 2005
149
US
Function returnRawCurveSet

Set rawCurveSet = New ADODB.Recordset
rawCurveSet.Open rawCurveSQL, CurrentProject.Connection, adOpenKeyset

returnRawCurveSet = rawCurveSet

end function


subroutine
Dim rawCurveSet2 As ADODB.Recordset

[highlight]rawCurveSet2 = returnRawCurveSet[/highlight]

rawCurveSet2.MoveFirst
MsgBox rawCurveSet2![mw]

end subroutine

I get a compile error; invalid use of property.

What am I missing?
 
You have to use the Set instruction to instantiate an object:
Function returnRawCurveSet
Dim rawCurveSet As ADODB.Recordset
Set rawCurveSet = New ADODB.Recordset
rawCurveSet.Open rawCurveSQL, CurrentProject.Connection, adOpenKeyset
[!]Set[/!] returnRawCurveSet = rawCurveSet
End Function

subroutine
Dim rawCurveSet2 As ADODB.Recordset
[!]Set[/!] rawCurveSet2 = returnRawCurveSet
rawCurveSet2.MoveFirst
MsgBox rawCurveSet2![mw]
end subroutine

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Sha-Bam! Thanks PHV. You sure are quick on the draw. I tried this earlier, but only in one place not both.

Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top