开发者

VB 6 pass argument As Database to function - type mismtach

开发者 https://www.devze.com 2023-02-03 05:45 出处:网络
I try to pass argument to function (Visual Basic 6) Dim oDB As Database .. oDB = OpenDatabase(databaseName$)

I try to pass argument to function (Visual Basic 6)

Dim oDB As Database .. oDB = OpenDatabase(databaseName$)

SampleFunction(oDB) ' here error type mismatch

..

Function SampleFunction(ByRef oDB As Database)

' oDB.TableDefs("tableName")

End Function

How can I pass开发者_如何学Python this argument correctly?

Thanks


The problem is not located in the Database, but in the call to the SampleFunction:

Either write:

Call SampleFunction(oDB)

or:

SampleFunction oDB

or:

Dim x
x=SampleFunction(oDB)

By the way: you are much better off by first going to sites like www.vb6.us or visualbasic.freetutes.com


One thing might be that you need to use Set

Set oDB = OpenDatabase(databaseName$)
0

精彩评论

暂无评论...
验证码 换一张
取 消