Type Mismatch Problem with Database Object

Type Mismatch Problem with Database Object

Post by Jo » Sun, 20 Oct 2002 05:28:42



Hello all,

I'm having a problem, which is making me want to pull my hair out.  We
have an application, which was developed in VB4.  We also have an
add-in component, which is an ActiveX server developed with VB4.
We're wanting to upgrade everything to VB6.  I've started by trying to
upgrade the ActiveX to VB6 first. I'm using the DAO database object.
Everything works fine when teh ActiveX is compiled in VB4, but using
VB6, I keep getting a "Type Mismatch" error.  Here's the line in
particular.

QFDDB.DB = Mommy.QFD3DB

QFDDB.DB is a public property, which expects a database object.  
Mommy.QFD3Db, is actually an object from the main application.  It is
also a database object.  This line gives a type mismatch when compiled
under VB6, but not VB4.  Anyone know what's up?  Thanks.

Joe

 
 
 

Type Mismatch Problem with Database Object

Post by Douglas J. Steel » Sun, 20 Oct 2002 20:45:22


If DB is expecting an object, it probably should be

     Set QFDDB.DB = Mommy.QFD3DB

although I can offer no explanation as to why it would work in VB4.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele


Quote:> Hello all,

> I'm having a problem, which is making me want to pull my hair out.  We
> have an application, which was developed in VB4.  We also have an
> add-in component, which is an ActiveX server developed with VB4.
> We're wanting to upgrade everything to VB6.  I've started by trying to
> upgrade the ActiveX to VB6 first. I'm using the DAO database object.
> Everything works fine when teh ActiveX is compiled in VB4, but using
> VB6, I keep getting a "Type Mismatch" error.  Here's the line in
> particular.

> QFDDB.DB = Mommy.QFD3DB

> QFDDB.DB is a public property, which expects a database object.
> Mommy.QFD3Db, is actually an object from the main application.  It is
> also a database object.  This line gives a type mismatch when compiled
> under VB6, but not VB4.  Anyone know what's up?  Thanks.

> Joe


 
 
 

Type Mismatch Problem with Database Object

Post by Unicor » Mon, 21 Oct 2002 22:24:55


I think that your problem might just be in the type of object.  You don't
explicitly say which version of DAO you are using.  Is it possible you are
passing a DAO2? object from the main application to an ActiveX which is
expecting a DAO3.5 object following the upgrade to VB6.

Matt


Quote:> Hello all,

> I'm having a problem, which is making me want to pull my hair out.  We
> have an application, which was developed in VB4.  We also have an
> add-in component, which is an ActiveX server developed with VB4.
> We're wanting to upgrade everything to VB6.  I've started by trying to
> upgrade the ActiveX to VB6 first. I'm using the DAO database object.
> Everything works fine when teh ActiveX is compiled in VB4, but using
> VB6, I keep getting a "Type Mismatch" error.  Here's the line in
> particular.

> QFDDB.DB = Mommy.QFD3DB

> QFDDB.DB is a public property, which expects a database object.
> Mommy.QFD3Db, is actually an object from the main application.  It is
> also a database object.  This line gives a type mismatch when compiled
> under VB6, but not VB4.  Anyone know what's up?  Thanks.

> Joe

 
 
 

Type Mismatch Problem with Database Object

Post by Rames » Tue, 22 Oct 2002 22:44:22


Hello Joe,
I think matt is right, We may be passing the wrong type of object when the
error happens.
You may be running into the problem mentioned in the following article
Q181542 PRB: Error 13 Type Mismatch Error on DAO OpenRecordset Method
http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q181542

Check the declaration of the public property make sure you are passing the
right DAO database object
with the right version.

HTH

Ramesh Thyagarajan, MCSD,MCDBA
Microsoft Developer support

This posting is provided "AS IS" with no warranties, and confers no rights.

Are you secure? For information about the Microsoft Strategic Technology
Protection Program and to order your FREE Security Tool Kit, please visit
http://www.microsoft.com/security.

 
 
 

1. SQLDMO and user2 object type mismatch error

I am trying to use obtain a user2 object in SQLDMO while
looping through a Users collection, but I run across a
type mismatch each time because the Users colleciton is
returning a User object.  I read through the BOL piece
(Programming Extended SQL-DMO Objects) about
being "precise" in the naming when binding, but I have a
problem whether I use late or early binding.  For example:

Dim objSQLServer As New SQLDMO.SQLServer2
objSQLServer.Connect strServer, strUser, strPass
Dim objUser As SQLDMO.User2
Set objUser = objSQLServer.Databases("northwind").Users(1)

This results in a Run-Time error '13': Type mismatch
This code follows the example about late binding but still
fails because the Users collection returns a User object,
not User2

I have a function which loops through all the objects of a
database, and I am able to create "2" versions of all
other objects without any problems.  User2 is the lone
exception.

For example, this works:

Dim objSQLServer As New SQLDMO.SQLServer2
objSQLServer.Connect strServer, strUser, strPass
Dim objSP As SQLDMO.StoredProcedure2
Set objSP = objSQLServer.Databases
("northwind").StoredProcedures(1)

Anyone run across this problem? Know of a workaround to
get a user2 object?

2. Schedule cube processing

3. Type Mismatch while using Activex Script Task with numeric data type

4. Relational db report question

5. type mismatch error while importing data to a BIT type column

6. i mac computer problem

7. Type Mismatch when Adding Matching Type Decimal Fields

8. 1995 Developers Competition - Free Passes

9. Data Types in CreateParameter statement causing type mismatch

10. Type Mismatch reading from Access 2K of type Date

11. Return type mismatch when using MFC ODBC class with decimal type

12. Type Mismatch problem in DTS/ActiveX

13. Type Mismatch - problem