Solved

Error loading DLL (CurrentProject.Connection)

Posted on 2004-08-06
8
997 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
 
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
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 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Today's users almost expect this to happen in all search boxes. After all, if their favourite search engine juggles with tens of thousand keywords while they type, and suggests matching phrases on the fly, why shouldn't they expect the same from you…
Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

920 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now