Error 3001 - Arguments are of the wrong type... 
Author Message
 Error 3001 - Arguments are of the wrong type...

This is using MDAC 2.5 (2.50.4403.12) with VB6, service pack 4.  Problem
occurs on both Win98 and Windows 2000.

I have an Active X exe which references some DLL files (late bound).  It
passes ADODB.Connection objects to these DLL files.  The software works
successfully except in the VB IDE environment.

The code that it errors on looks like:

Public function x(cn as adodb.connection) as boolean

dim rs as adodb.recordset

set rs=new adodb.recordset
with rs
    .ActiveConnection = cn
    .open "Select * from table"
end with

The error occurs on the .ActiveConnection line.

In the debug window I can enter:

cn.execute "Delete * from table where Field1='xxx'"

without any problems so I know the connection is valid and the .State of the
connection is 1.

If I put both .DLL files and the activex EXE file into the IDE together and
make them early
bound I can run in the IDE without any problems.

I have tried passing by Object as well as using ADODB.Connection.

I have tried doing the open (without success) by simply using:
rs.open "Select * from table",cn

I believe this to be a problem with ADO, and have yet to come up with a work
around.

Anyone have any ideas.

Thanks,

Mike



Mon, 10 Feb 2003 03:00:00 GMT
 Error 3001 - Arguments are of the wrong type...


Quote:
> This is using MDAC 2.5 (2.50.4403.12) with VB6, service pack 4.  Problem
> occurs on both Win98 and Windows 2000.

> I have an Active X exe which references some DLL files (late bound).  It
> passes ADODB.Connection objects to these DLL files.  The software works
> successfully except in the VB IDE environment.

> The code that it errors on looks like:

> Public function x(cn as adodb.connection) as boolean

> dim rs as adodb.recordset

> set rs=new adodb.recordset
> with rs
>     .ActiveConnection = cn
>     .open "Select * from table"
> end with

> The error occurs on the .ActiveConnection line.

> In the debug window I can enter:

> cn.execute "Delete * from table where Field1='xxx'"

> without any problems so I know the connection is valid and the .State of
the
> connection is 1.

> If I put both .DLL files and the activex EXE file into the IDE together
and
> make them early
> bound I can run in the IDE without any problems.

> I have tried passing by Object as well as using ADODB.Connection.

> I have tried doing the open (without success) by simply using:
> rs.open "Select * from table",cn

> I believe this to be a problem with ADO, and have yet to come up with a
work
> around.

> Anyone have any ideas.

> Thanks,

> Mike

Well, AFAIK you can't pass a connection object between processes. So perhaps
your problem is resulting from the way the vb IDE "runs" a program that uses
external dlls?
Just a thought.
SR


Mon, 10 Feb 2003 03:00:00 GMT
 Error 3001 - Arguments are of the wrong type...

Thanks for the response.  Not the answer I wanted, but it makes sense.

Mike

Quote:

> Well, AFAIK you can't pass a connection object between processes. So
perhaps
> your problem is resulting from the way the vb IDE "runs" a program that
uses
> external dlls?
> Just a thought.
> SR



Tue, 18 Feb 2003 06:20:09 GMT
 Error 3001 - Arguments are of the wrong type...
It took me a while to remember where I'd read about this. It's in Dan
Appleman's 'Developing COM/ActiveX Components with Visual Basic 6', chpt. 9.
To summarize a *lot* of info into one quote:
'Visual Basic can provide true in-process support for components only when
both the component project and the client project that uses the component
are loaded into the same instance of Visual Basic.'
So you just need to keep the dll projects and the client exe project in one
program group. Or, don't pass connections. :-)
Good luck!
SR


Quote:
> Thanks for the response.  Not the answer I wanted, but it makes sense.

> Mike


> > Well, AFAIK you can't pass a connection object between processes. So
> perhaps
> > your problem is resulting from the way the vb IDE "runs" a program that
> uses
> > external dlls?
> > Just a thought.
> > SR



Tue, 18 Feb 2003 11:09:21 GMT
 
 [ 4 post ] 

 Relevant Pages 

1. ERROR 3001 - "Invalid Argument"

2. OpenRecordset 3001 Invalid Argument error

3. Error 3001, Invalid Argument, Not all the time!

4. Error 3001: Invalid argument

5. Error 3001 - Invalid argument

6. Please Help...Linking MBD's with code -- ERROR 3001 - Invalid Argument

7. run-time error 3001, syntax is wrong?

8. ADO Recordset Error '3001: Arguments are of the wrong type...."

9. Runtime error 3001 - arguments are of the wrong type, are out of acceptable range, or are in conflict with one another

10. Why am I getting a ByRef argument type mismatch error

11. CompactDatabase gives "3001: Invalid Argument"

12. Arguments are of wrong type, COM, Connectioread, activeconnection errors


 
Powered by phpBB® Forum Software