VB6 project issue which applying DAO3.6 library - vb6

I have an VB6 application.
When trying to Start it prompts an error ActiveX component can't create object
The program is failed in below line
Set GCIWCon = CreateObject("Dbsecurity.database")
I have checked that DAO3.6 library is existed and below line can be executed
CreateObject ("Excel.Sheet")
Thus, I assumed that DAO3.6 is working properly, but the object "Dbsecurity.database" is not found.
I do have a rough idea about the DAO library but I have no idea what is missing in order to make the issued line work.
Can anyone suggest what the object "Dbsecurity.database" can be and how to include it in the VBA?
Thanks

Related

having an issue with setting up ImageMagick in my VB6 IDE

I found ImageMagick online and am trying to add it to one of my legacy VB6 projects to convert some .jpgs --> PDFs.
I installed and registered the dll:
ImageMagick-7.0.7-29-Q16-x64-dll.exe
I added the reference in my projects without any issues:
ImageMagicObject 1.0 Type Library
The problem now comes when I try to create an object of ImageMagickObject.MagickImage.1 like so:
'Dim your object as a simple Object
Dim imgMkObj As Object
'Set your object
Set imgMkObj = CreateObject("ImageMagickObject.MagickImage.1")
'Convert your image
MsgBox imgMkObj.Convert("C:\source.jpg", "-resize=800x600", "C:\destination.pdf")
When it gets to the SET part, it gives me an error
Run Time error 429
ActiveX component can't create object
And I really have no idea how to proceed from here. Is there a ImageObject component that I need to have added in my app (OCX) to make this work. I'm trying to programmatically (not command line) to change the formats of some documents.
Can anyone shed some light on this?
Thanks.
It looks like you've installed the 64 bit version of the DLL.
If they offer a 32 bit install that might solve your problem?
VB6 is a 32 bit application

Adding VBA reference in VB6.0

I have a old VB 6.0 application written by someone else. When i compile the application, it throws error on every line of code where VBA reference is required so fro e.g. it throws an error in the following lines:
Left$, Chr, Trim$
As soon as I prefix it with VBA.Left$, the error goes away. I was looking at the list of project References and saw only one missing reference called "Microsoft DTS run time 1.0". Where can I get this reference from and how can I add this in VB application. Also, is there any way, I can add VBA reference to VB application. I am running this VB application on XP machine.
any help will be appreciated.
Then you should install Microsoft DTS runtime:
How to: Install Support for Data Transformation Services Packages:
https://technet.microsoft.com/en-us/library/ms143755(v=sql.105).aspx
After, add the VBA reference (if is missing)
If you look at your list of Available References, you should see one for Visual Basic For Applications. Make sure this is checked and you will be good to go.
If there is more than one reference for VBA, select the one for msvbvm60.dll.

Object library not registered VB 6

I am trying to open a VB project on Windows 7 64 bit version. I installed VB 6 successfully and registered the required components (.ocx) too. For the application, I use a third party tool called TX - Text Control and need to register that too using the registry server tool as follows:
C:\Windows\SysWOW64>regsvr32 tx4ole.ocx
Upon opening up the project, I get a bunch of errors like "Object Library not registered" even when Ive registered the component as above. Upon pressing "OK" and proceeding, it complains about the texteditor.ocx not registered. But I did register that too. I get a log message in the project directory which has the message as follows:
Line 74: Class Tx4oleLib.TXTextControl of control txEditor was not a loaded control class.
Tried all un-registering all the components, un-installing VB6, fresh-installing using administrator and registering all the above components again with administrative privs but same result. Any idea why that would happen ?
I just encountered the same problem and actually found two issues. The first is "Object library not registered" issue. I solved that using another answer on Stack Overflow.
Basically I ran the command regtlibv12.exe msdatsrc.tlb from C:\Windows\Microsoft.NET\Framework\v4.0.30319.
The second issue was that I couldn't compile because of a missing reference. To fix that, I clicked project->References and then unchecked all references. I then reran the project (which failed). Next, I added back the necessary references using project->References. For missing references I used the browse button to find and add the missing references.

VB 6.0 debugging breakpoint doesn't hit

I have a VB 6.0 Project having Class (cls) files. When I start (Debug) my project, and try to execute following statement in Classic ASP page,
Set objMyObject = Server.CreateObject("ProjName.ClassName")
No breakpoint is hit and following error occurs.
Microsoft VBScript runtime error '800a01ad' ActiveX component can't
create object
While if I use the same statement in another VB Project (test project) then breakpoint hits with no error.
Can anyone help ?
Well you are trying to create an instance of a COM object with the name 'ProjName.ClassName' - which is unlikely to be a real COM object.
Either your COM class needs to be one that has been registered in Windows, or it needs to be a class defined within your VB project.
The example in MSDN is:
Sub CreateADODB()
Dim adoApp As Object
adoApp = CreateObject("ADODB.Connection")
End Sub
Where ADODB.Connection is a COM class that has been previously registered in Windows. The code you have provided above is trying to instantiate a non existant class (unless it is already within the same VB project).
You say that the other project this works, then I will hazard a guess that the test project has a class called ClassName.
Ok -Updated. The error code is not 'DLL Missing' - It is likely to be some reason why the COM object could not be instantiated. The following Microsoft support page suggests some reasons and ways of tracking down the problem. Its likely to be some sort of missing dependency to the DLL.
http://support.microsoft.com/kb/194801

createObject in VB6 does fails when running exe

I have a VB6 program which tries to run a DLL written in C#.
This DLL has a COM interface so I can create an object of a class in it with "CreateObject".
The problem is that it runs and works well when I run it from the VB6 IDE, but when I make an EXE and try to run it, it throws the exception:
"Automation error. The system cannot find the file specified (-2147024894)."
Why is it happening and how can i solve it?
Look at Project, References in the IDE and look which dll or ocx file belongs to the object you are referencing with CreateObject (the Object Manager might also help to find out).
This dll file must be available when the exe is compiled, too. Usually, you need to have it registered with regsvr32.exe.
A technique I use to figure issues of this type is to open the add reference dialog in Visual Basic 6. I scroll the list of available COM Libraries and see if the problem DLL is listed. If it is then CreateObject should work, you should be able to assign it do a variant variant and use late binding to access it's members.
In addition try temporally set a reference to the variable and instead of using CreateObject use the = New and see what error messages, if any, it gives you. Generally I found them to be more informative then the ones thrown by CreateObject.
Finally it would help if you post the reason why you are choosing to use CreateObject instead of setting of a reference. If the DLL is a known object that will be continually used by the program then a reference should be set and early binding generally used.
Finally it may be that the error is resulting from a dependency of the C# COM DLL not the DLL itself. If for example I was to take a Com Library and properly register it but it relies on the COM Library Widget2000 and it NOT registered then it will throw the automation error. Especially if you are testing the EXE in it's installed environment and not the environment in which you complied it.
For example suppose I have a CAD program written in VB6 and I have source tree that begins with MyCAD. THe exe is in MyCAD/MainEXE and the shape library is in MyCAD/ShapeLibrary. I run the IDE everything is fine. Then I make my setup and goto my test machine and install it and it error on the creation of shapelibrary.
The first thing I would do it check if MainEXE will run straight out of the MainEXE directory of my source tree. That test will eliminate whether it is a install issue or a quirk of the IDE vs complied version. Then I would look at the setup and see what not being registered. Also look at either the source for the C# library or the setup for the library and see what dependencies it needs. Since it a complied COM DLL you should be able to use a dependency walker tool to see what COM references it needs. Finally make sure the correct version of the .NET framework is installed.
If you are compiling the C# DLL on your test machine - make sure you have ticked the register for COM Interop setting. If you are not compiling on the same machine you need to run RegAsm with the /codebase option.
try compiling it as an installer and include the dll/com that you use in the compilation of the installer package so that the dll/com that you use will be include in the compilation of your exe.., and install it in the windows not just copy past it.

Resources