Re: Method '~' of object '~' failed error while opening ADODB connection in vb6



On Apr 17, 10:01 pm, swapna.munuk...@xxxxxxxxx wrote:
On Apr 17, 6:45 pm, "Ralph" <nt_consultin...@xxxxxxxxx> wrote:





<swapna.munuk...@xxxxxxxxx> wrote in message

news:226a8986-65c2-4448-8931-2a44b14cea33@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Hi all,

I am using VB6, MS-Access2000 for my application. The application is
running fine from IDE. But when it is build and run using the
binaries, it is throwing the error "Method '~' of object '~' failed".
When put messages, I found that in the following code, the last line
causing the error.

Dim mcnDBData As ADODB.Connection
Set mcnDBData = New ADODB.Connection
Dim strConnectionString as string
strConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=F:
\Data\Test.mdb;Persist Security Info=False;Jet OLEDB: Database
Password=LFSGenesis;"
Call mcnDBData.Open(strConnectionString)

Can anybody let me know what can cause such an error?

You left out a few pieces of important information.
1) What O/S are you using?
2) Is this something that happens all the time, or just something that
happens for this one specific project.

If "all the time" for "all projects", then the most common reason is because
the MDAC or Jet installation is "corrupt" (anything from incorrect
registration, wrong version, mismatched to bad components). You can use this
utility to check the MDAC out.http://www.microsoft.com/downloads/details..aspx?FamilyID=8f0a8df6-4a2...

Normally it is just easier to re-install the appropriate MDAC or Jet for
your O/S.
MDAChttp://msdn2.microsoft.com/en-us/data/aa937729.aspx
Jethttp://support.microsoft.com/kb/239114/

Note that these are all dependent on the OS you are using.
For example, if using Vista - you can't install the MDAC as it already comes
with its own DAC.
If you are using Win2000 then you may also need to install the latest
service pack.http://support.microsoft.com/kb/260910/en-us

I included the above information because it is useful to know. However, if
this is only a problem for a specific project then I would question that
connection string. (You might also check your Project References.)

You can use the "Data Link" utility to create and *test* your connection..
Look up "Data Link" in Windows Help (from the start or globe menu). You
create a blank file with a ".udl" extension and then double-click it in
Explorer to open the Data Link dialog. After testing and saving - you can
then open the file with notepad and copy the string to your program.

hth
-ralph- Hide quoted text -

- Show quoted text -

Thanks for your suggestions...
My work environment:
OS: Win 2k
MDAC is not installed separately. It has come along with I think
Microsoft visual Studio.
In project references it lists "Microsoft ActiveX Data Objects 2.5
library", "Microsoft ActiveX Data Objects 2.6 library", "Microsoft
ActiveX Data Objects 2.7 library", "Microsoft ActiveX Data Objects 2.0
library".

What ever version is chosen, it is throwing the same error.

It never happened before. This is the first time I am facing this
error. I am using the same system for the same application for years.

In the same machine, the application is working fine for the same
connection string thru IDE.

Regards,
Swapna- Hide quoted text -

- Show quoted text -

Hi,

Perhaps the mdb file is corrupt. If necessary, I think you can try a
utility called Advanced Access Repair to repair your Access MDB file.
It works rather well for my corrupt Access MDB files. Its web address
is http://www.datanumen.com/aar/

Alan

.



Relevant Pages

  • Re: Method ~ of object ~ failed error while opening ADODB connection in vb6
    ... the MDAC or Jet installation is "corrupt" (anything from incorrect ... if using Vista - you can't install the MDAC as it already comes ... ActiveX Data Objects 2.7 library", ... connection string thru IDE. ...
    (microsoft.public.vb.database)
  • Re: Method ~ of object ~ failed error while opening ADODB connection in vb6
    ... MDAC is not installed separately. ... ActiveX Data Objects 2.7 library", "Microsoft ActiveX Data Objects 2.0 ... Did you install any new applications lately? ...
    (microsoft.public.vb.database)
  • Re: VB app &mdb files without MS Access
    ... Can I install the Access driver onto a non-Access ready ... PC and still connect to the mdb file (therefore negating ... connection string etc (would MDAC need to be installed ... You would need Jet and MDAC: ...
    (microsoft.public.vb.database.ado)
  • Re: VB.NET Deployment - Checking for user-modified files
    ... I think your MDB file would be an unversioned file and so: ... Create date for the file on the computer, do not install the file because ... > the installation problem with preferences by using a text file for ... properties and set to not overwrite. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Creating an Office XP compatible database?
    ... I suppose just updating to the newest MDAC Components you ... somewhere where the Jet engine wasn't included. ... > Then I took the program over to my notebook, which runs under Windows> XP Pro and has Office XP installed, recompiled the program, and> recreated the .mdb file. ...
    (microsoft.public.vb.database.dao)