dcsimg
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Thread: VB6 Run time error '-2147217843 (80040e4d) Not a valid Password

  1. #1
    Join Date
    May 2005
    Posts
    6

    VB6 Run time error '-2147217843 (80040e4d) Not a valid Password

    I have a program that has been working with this code perfect since I created it over a year ago. I am always updateing and modifying code except I never touch this block because it is a minor open connection code.

    Yesterday all my ADODB connections to all my access programs in several different projects have caused this error upon open.

    I tested the project on another development computer I have and it works fine with no errors.

    If I create an .exe from my source.... it works fine. It will error out durring debug.

    So I know it has something to do with my computer but I cannot figure out what.

    Here is my code:

    Function connectDSN()
    Set MyConn = New ADODB.Connection
    MyConn.Provider = "Microsoft.Jet.OLEDB.4.0"
    MyConn.Properties("Data Source") = "DSN.MDB"
    MyConn.Properties("Jet OLEDBatabase Password") = "password"
    'MyConn = "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=false;Data Source= db1.mdb"
    MyConn.Open
    End Function

    Any suggestions would be appreciated.

    Thanks

  2. #2
    Join Date
    Jul 2000
    Location
    Milano, Italy
    Posts
    7,726

    Re: VB6 Run time error '-2147217843 (80040e4d) Not a valid Password

    Seems as if in Ide your machine is not able to find jet 4.0... Try downolad latest jet
    from microsoft and install it again


    But as you said on same machine it works, there could be a small mistake (say a
    different capitalization, or a different clsid) in your vbp source. Try editing the Vbp
    file with notepad to see if you can find something of strange comparing it
    with same source pasted in a new vbp and saved for this purpouse....
    Last edited by Cimperiali; May 5th, 2005 at 02:04 AM.
    ...at present time, using mainly Net 4.0, Vs 2010



    Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
    all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

  3. #3
    Join Date
    May 2005
    Posts
    6

    Re: VB6 Run time error '-2147217843 (80040e4d) Not a valid Password

    I have all the latest updates. I've been running Windows XP SP2 for awhile. I tried downloading Jet 4.0 SP8 for XP but it said my Windows SP already installed is a newer version. I reinstalled the newest MDAC 2.7 also.

    The code that I posted is correct. I copied the same VB project to another computer and it ran perfect with no code change.

    I can also create an executable and run it on my machine in question and it runs fine. It just gets this error when I run it in VB6 development.

    I installed the latest SP of VB6 also and that did no change.

  4. #4
    Join Date
    May 2005
    Posts
    6

    Re: VB6 Run time error '-2147217843 (80040e4d) Not a valid Password

    I also have another function that connects to a Pervasive database and I use this code:

    Set MedTekCon = New ADODB.Connection
    MedTekCon.CursorLocation = adUseClient
    MedTekCon.Open "Provider=MSDASQL.1;Persist Security Info=False;Data Source=" & DSNPractice & ";User ID=Admin;Password=Password;"

    This code works fine so it leads me to believe it has something to do with the Provider and the Microsoft jet 4.0.... but I have the latest updates and I haven't changed anything before this error started happening

  5. #5
    Join Date
    May 2005
    Posts
    6

    Re: VB6 Run time error '-2147217843 (80040e4d) Not a valid Password

    Quote Originally Posted by Cimperiali
    Seems as if in Ide your machine is not able to find jet 4.0... Try downolad latest jet
    from microsoft and install it again


    But as you said on same machine it works, there could be a small mistake (say a
    different capitalization, or a different clsid) in your vbp source. Try editing the Vbp
    file with notepad to see if you can find something of strange comparing it
    with same source pasted in a new vbp and saved for this purpouse....

    I'm not sure what I'm looking for.... but I'll copy and paste my project and a newly saved blank project.

    Type=Exe
    Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#..\..\..\..\..\..\WINDOWS\system32\stdole2.tlb#OLE Automation
    Reference=*\G{6C002C9B-5BCE-4E4A-BFF9-18E684A801F5}#1.0#0#..\..\..\..\..\..\PVSW\bin\pcc.exe#Pervasive Control Center 2.0 Type Library
    Reference=*\G{00025E01-0000-0000-C000-000000000046}#4.0#0#..\..\..\..\..\..\Program Files\Common Files\Microsoft Shared\DAO\DAO350.DLL#Microsoft DAO 3.51 Object Library
    Reference=*\G{00000205-0000-0010-8000-00AA006D2EA4}#2.5#0#..\..\..\..\..\..\Program Files\Common Files\system\ado\msado25.tlb#Microsoft ActiveX Data Objects 2.0 Library
    Reference=*\G{FC4415F0-7E2C-11D0-B5FD-00A0C922E851}#1.0#0#..\..\..\..\..\..\Program Files\Microsoft Script Debugger\filesvc.dll#FileServiceLib
    Reference=*\G{420B2830-E718-11CF-893D-00A0C9054228}#1.0#0#..\..\..\..\..\..\WINDOWS\system32\scrrun.dll#Microsoft Scripting Runtime
    Object={1B773E42-2509-11CF-942F-008029004347}#3.6#0; sysmon.ocx
    Reference=*\G{3D5C6BF0-69A3-11D0-B393-00A0C9055D8E}#1.0#0#..\..\..\..\..\..\Program Files\Common Files\designer\MSDERUN.DLL#Microsoft Data Environment Instance 1.0 (SP4)
    Reference=*\G{56BF9020-7A2F-11D0-9482-00A0C91110ED}#1.0#0#..\..\..\..\..\..\WINDOWS\system32\msbind.dll#Microsoft Data Binding Collection VB 6.0 (SP4)
    Reference=*\G{6B263850-900B-11D0-9484-00A0C91110ED}#1.0#0#..\..\..\..\..\..\WINDOWS\system32\msstdfmt.dll#Microsoft Data Formatting Object Library 6.0 (SP4)
    Reference=*\G{DBE2B0CE-6BE9-48FE-8300-6ABE0DB9692B}#1.0#0#..\..\..\..\..\..\PVSW\Bin\dto2.dll#Pervasive Distributed Tuning Library 2.0
    Object={67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0; msadodc.ocx
    Object={0ECD9B60-23AA-11D0-B351-00A0C9055D8E}#6.0#0; mshflxgd.ocx
    Object={648A5603-2C6E-101B-82B6-000000000014}#1.1#0; mscomm32.ocx
    Object={831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0; mscomctl.ocx
    Form=Main.frm
    Module=Display_upload; Display_upload.bas
    Form=frmEdit.frm
    Form=frmSplash.frm
    Form=frmAbout.frm
    Form=frmLogin.frm
    Form=frmSettings.frm
    Form=frmSettingsEdit.frm
    Form=MainDetail.frm
    Module=Display; Module1.bas
    Module=Module2; Module2.bas
    Form=frmNote.frm
    Form=frmProgress.frm
    Form=frmSplashOpen.frm
    Form=frmDBN.frm
    Module=Global; DBN.bas
    Module=global2; DSN.bas
    Form=frmPractice.frm
    Form=DxSearch.frm
    Module=Reg; Reg.bas
    Form=frmRegister.frm
    IconForm="MainFRM"
    Startup="frmPractice"
    HelpFile=""
    Title="SuperBillable"
    ExeName32="SuperBillable.exe"
    Path32="..\..\..\..\..\..\Documents and Settings\ndaniels\Desktop"
    Command32=""
    Name="SuperBillable"
    HelpContextID="0"
    CompatibleMode="0"
    MajorVer=1
    MinorVer=0
    RevisionVer=0
    AutoIncrementVer=0
    ServerSupportFiles=0
    VersionCompanyName="MedTek"
    CompilationType=0
    OptimizationType=0
    FavorPentiumPro(tm)=0
    CodeViewDebugInfo=0
    NoAliasing=0
    BoundsCheck=0
    OverflowCheck=0
    FlPointCheck=0
    FDIVCheck=0
    UnroundedFP=0
    StartMode=0
    Unattended=0
    Retained=0
    ThreadPerObject=0
    MaxNumberOfThreads=1
    DebugStartupOption=0

    [MS Transaction Server]
    AutoRefresh=1


    and....................

    Type=Exe
    Form=Form1.frm
    Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#..\..\..\..\WINNT\system32\stdole2.tlb#OLE Automation
    Startup="Form1"
    Command32=""
    Name="Project1"
    HelpContextID="0"
    CompatibleMode="0"
    MajorVer=1
    MinorVer=0
    RevisionVer=0
    AutoIncrementVer=0
    ServerSupportFiles=0
    VersionCompanyName="MedTek"
    CompilationType=0
    OptimizationType=0
    FavorPentiumPro(tm)=0
    CodeViewDebugInfo=0
    NoAliasing=0
    BoundsCheck=0
    OverflowCheck=0
    FlPointCheck=0
    FDIVCheck=0
    UnroundedFP=0
    StartMode=0
    Unattended=0
    Retained=0
    ThreadPerObject=0
    MaxNumberOfThreads=1

    [MS Transaction Server]
    AutoRefresh=1

  6. #6
    Join Date
    Jul 2000
    Location
    Milano, Italy
    Posts
    7,726

    Re: VB6 Run time error '-2147217843 (80040e4d) Not a valid Password

    Reference=*\G{00025E01-0000-0000-C000-000000000046}#4.0#0#..\..\..\..\..\..\Program Files\Common Files\Microsoft Shared\DAO\DAO350.DLL#Microsoft DAO 3.51 Object Library
    Reference=*\G{00000205-0000-0010-8000-00AA006D2EA4}#2.5#0#..\..\..\..\..\..\Program Files\Common Files\system\ado\msado25.tlb#Microsoft ActiveX Data Objects 2.0 Library
    In your project there are both DAo and Ado.

    Some names are in common, even if they are different objects.
    As a test, you could edit the Vbp to switch the two, putting Ado first

    The good solution should be to specify in code "ADODB." as prefix to your ado
    objects (ie: dim Cnn as Adodb.Connection) and "DAO." when you need the other
    one (ie: dim CnD as DAO.Connection)

    Note you are referncing ADO 2.0, which is not latest Ado but one of the first

    One soultuon could be:
    Create a new project and set a reference to Ado 2.8.
    Save it and then open the vbp with notepad.
    Find the line with ado, and copy it. Paste it upon the one you have in the non working project.
    On my machine, that line is like the following:
    Code:
    Reference=*\G{2A75196C-D9EB-4129-B803-931327F72D5C}#2.8#0#..\..\..\Common Files\System\ADO\msado15.dll#Microsoft ActiveX Data Objects 2.8 Library
    Note: msado15.dll=Ado 2.8!

    Another way could be: remove ado reference from project, save it,
    close, reopen, add reference to Ado 2.8, save and then test again...

    By the way, you do not need DAO to use Ado to connect to Access db...
    Last edited by Cimperiali; May 6th, 2005 at 03:44 AM.
    ...at present time, using mainly Net 4.0, Vs 2010



    Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
    all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)