Solved

Error loading DLL (CurrentProject.Connection)

Posted on 2004-08-06
8
1,005 Views
Last Modified: 2008-01-16
Have searched the other solutions to this error without success. I have code which has always worked and now throws up an error loading dll. I've tried repairing Access 2003 and a complete reinstall but still no joy. I have no 'Missing references' under the tools menu of the VBE and all dll appear in the common files folder. The code I'm using is:

Private Sub Employee_NotInList(NewData As String, Response As Integer)

    Dim strMessage As String
    Dim rstEmployees As New ADODB.Recordset
   
    strMessage = "Do you want to add '" & NewData & "' to the employee list?"

    If Confirm(strMessage) Then

        rstEmployees.Open "tblEmployees", CurrentProject.Connection, adOpenKeyset, adLockOptimistic
       
                                'CurrentProject.Connection is where the code stops.

        rstEmployees.AddNew
        rstEmployees!EmployeeName = NewData
        rstEmployees.Update
        Employee = rstEmployees!Employee
       
        Response = acDataErrAdded    
    Else
        Response = acDataErrDisplay  
    End If

End Sub

Any ideas please?
0
Comment
Question by:Sover
8 Comments
 
LVL 39

Expert Comment

by:stevbe
ID: 11736240
1. Do you have other code that sets a variable to CurrentProject.Connection and then closes the connection?

Set cn = CurrentProject.Connection
   ' ...
cn.Close

2. Sometimes references are messed up but don't list as Missing ... uncheck any reference, close the reference dialog, reopen references and recheck the one you unchecked. This sometimes happens when upgrading (not limited to Access upgrades)

3. Have you tried /decompile and importing into a new database?

Steve

0
 
LVL 13

Expert Comment

by:lucas911
ID: 11736255
Decompiling link here for access 97 though, same concept for 2003 i think

http://www.granite.ab.ca/access/decompile.htm
0
 
LVL 1

Author Comment

by:Sover
ID: 11736718
Hi Stevbe, thanks for the suggestions. I've tried all those now and no success. I have however loaded the database onto a laptop and the code runs fine. This is running Access 2002. Looking at the references the only difference is that the laptop uses Access 10.0 Object library and the main PC (Access 2003) refers to Access 11.0 Object Library. This reference can not be changed, I tried. Alsot he database utilities Convert Database to 2002-2003 format is blanked out as the db is already in that format. (no surprise there then).
0
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 
LVL 1

Author Comment

by:Sover
ID: 11737080
Thanks for the decompile link lucas. It didn't work on this particular problem but is a useful reference.
0
 
LVL 49

Accepted Solution

by:
Gustav Brock earned 500 total points
ID: 11743052
I've seen something similar.
After much trouble and testing, a reinstall (or update) of the MDAC did it. No explanation why.

You can locate and download this from the Microsoft site:

  http://www.microsoft.com/downloads/results.aspx?productID=&freetext=mdac&DisplayLang=en

/gustav
0
 
LVL 1

Author Comment

by:Sover
ID: 11746992
Thanks gustuv. Worked first time. As you say, no explanation why as everything checked out OK. Many thanks and many points your way. :-)
0
 
LVL 49

Expert Comment

by:Gustav Brock
ID: 11747042
Great! Thanks, I'll make a note on that. This is the second time I've met this error.

/gustav
0
 
LVL 49

Expert Comment

by:Gustav Brock
ID: 24590067
2009 update.

That solution won't work on modern machines (WinXP SP3 or Vista) because these by default install a newer version - or rather Service Pack - of MDAC 2.8.

Wondering how to reinstall the MDAC I located this page:

http://support.microsoft.com/kb/899861

which explains how to repair or reinstall only the MDAC from your install CDs.
Of course, if you have SP3 installed, in the guide change the refs to SP2 with SP3.

/gustav
0

Featured Post

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

806 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question