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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Type mismatch on ADODB.Recordset 1

Status
Not open for further replies.

Axoliien

Programmer
Aug 19, 2003
166
US
I have reduced my code to a simple function call to exemplify the problem, so here is the example. I only receive the following message:
Visual Basic
Run-time error '13':
Type mismatch

Code:
[blue]Private Sub[/blue] Form_Load()
    [blue]Dim[/blue] AccountRst [blue]As[/blue] ADODB.Recordset
    [blue]Set[/blue] AccountRst = [blue]New[/blue] ADODB.Recordset

    [green]'Error occurs here[/green]
    LoadAccountDetails (AccountRst)
[blue]End Sub[/blue]

[blue]Private Sub[/blue] LoadAccountDetails ([blue]ByRef[/blue] rst [blue]As[/blue] ADODB.Recordset)
    [green]'doesn't even have to do anything[/green]
[blue]End Sub[/blue]

As far as I can tell, there shouldn't be a problem. Any help is appreciated.
 
Try with call statement and parentheses:

[tt]call LoadAccountDetails(AccountRst)[/tt]

or without

[tt]LoadAccountDetails AccountRst[/tt]

Roy-Vidar
 
Still the same problem, I tried both ways. Any other ideas?
 
Sorry, no. My suggestion works on my setup (2002/2003), your code throws runtime error 13.

Roy-Vidar
 
This may work...

Code:
Private Sub LoadAccountDetails (ByRef varOne As Variant)

 Dim rstOne As ADODB.Recordset
 Set rstOne = varOne
  'code that modifies the data in the recordset
	...
 Set varOne = rstOne
 Set rstOne = Nothing
     
End Sub

Let me know...

 
I rebooted and it still didn't work, so I tried on another computer. Kind of weird, your solutions worked on another computer but not on mine. Rebooted again and it is fine now?!? Thanks for your help Roy.
 
Thank you - but with such symptoms, I'd be looking out for corruption signs in the db too - take care (and remember backups;-))

Roy-Vidar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top