>The following code generates an "Improper use of parameter" error on the indicated line ... What did I do wrong ???
>
>Private Sub Form_Load()
>
> Dim loCustList As New ADODB.Recordset
> loCustList = GetCustList <<< Error Generated >>>
>
>End Sub
>
>
>Private Function GetCustList()
>
> Dim loCn As New ADODB.Connection
> Dim loCm As New ADODB.Command
>
> loCm.CommandText = "SELECT customer_id, customername FROM EffDscRpt..Customers ORDER BY customer_id"
> loCn.Open "dsn=ibcntdmsql;uid=sa;pwd=titan29"
> loCm.ActiveConnection = loCn
>
> GetCustList = loCm.Execute
>
>End Function
>
>Assistance greatly appreciated ...
>
>Regards,
>
>Jason
Since your function returns a recordset (which is an object), you have to use the Set operator to assign the object returned from your function to your variable:
Set loCustList = GetCustList
Éric Moreau, MCPD, Visual Developer - Visual Basic MVP
Conseiller Principal / Senior Consultant
Moer inc.
http://www.emoreau.com