
Passing a Recordset to function gives Type mismatch (error 13)
Quote:
> I have a simple VB6 application which has a DAO control on a form,
named
> datCustomer, using Jet. In the form's Load event I call a procedure
and
> pass the recordset to it, and it returns a Type mismatch (error 13)
error.
> Here is an example of my code:
> Private Sub Form_Load()
> If MyProc( datCustomer, ... )
> .
> .
> .
> End If
> In the Modules:
> Public Function MyProc( SearchRecordset As Recordset, ... )
> .
> .
> .
> End Function
> I have done this in the past with VB5 without a hitch. What am I
doing
> wrong?
datCustomer is a control, the function wants a recordset. try
explicitly passing the Recordset property of the control. Also, I
don't use data controls but I seem to remember problems with using them
from Form_Load because they have not fully initialized yet. You may
need to use "Me.Show:Doevents" to force that, or move the code to
Form_Activate and add a flag to ensure it doesn't run more than once.
--
Please reply via the newsgroup only
Sent via Deja.com http://www.deja.com/
Before you buy.