Passing a Recordset to function gives Type mismatch (error 13) 
Author Message
 Passing a Recordset to function gives Type mismatch (error 13)

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?



Mon, 30 Sep 2002 03:00:00 GMT  
 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?

Do you also have ADO or RDO referenced?  If so, try "MyProc (SearchRecordset as
DAO.Recordset)"...

Regards,

Gregory Silvano
http://www.codehound.com
Free Internet Search Engine for VB Developers



Mon, 30 Sep 2002 03:00:00 GMT  
 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.



Mon, 30 Sep 2002 03:00:00 GMT  
 Passing a Recordset to function gives Type mismatch (error 13)

Quote:

>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.

Good Call - I missed that part.

Regards,

Gregory Silvano
http://www.codehound.com
Free Internet Search Engine for VB Developers



Mon, 30 Sep 2002 03:00:00 GMT  
 Passing a Recordset to function gives Type mismatch (error 13)
You are absolutely right.  I also have an ADO control on that form.  I
changed it to MyProc(SearchRecordset As dao,Recordset, ...) and it seems to
work.

Thanks.



Quote:
> On Thu, 13 Apr 2000 10:47:47 -0500, "Daniel Robert"

> >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?

> Do you also have ADO or RDO referenced?  If so, try "MyProc
(SearchRecordset as
> DAO.Recordset)"...

> Regards,

> Gregory Silvano
> http://www.codehound.com
> Free Internet Search Engine for VB Developers



Fri, 04 Oct 2002 03:00:00 GMT  
 Passing a Recordset to function gives Type mismatch (error 13)
This was not the problem since I tried this already and had the same message
(I guess I should have mentioned this previously).  The problem was that I
also have an ADO control.  I had to modify the procedure to
MyProc(SearchRecordset As ADO.Recordset, ...) and it seems to work fine.

Thanks for the info.


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.



Fri, 04 Oct 2002 03:00:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Worked fine yesterday, today I get Error 13 Type Mismatch errors

2. Error 13: Type Mismatch error

3. Passing user data type to function causes type mismatch error

4. Type Mismatch Run-Time error 13

5. Type Mismatch Error 13

6. type mismatch error '13'????

7. Using CurrentDB() receives Type Mismatch Error 13

8. Type mismatch, run-time error #13

9. type 13 mismatch error

10. ACC2000:Run Time Error '13': Type Mismatch

11. Invalid Reference (Error 13 - Type Mismatch)

12. Run -time error '13' Type Mismatch

 

 
Powered by phpBB® Forum Software