Solved

Error loading DLL (CurrentProject.Connection)

Posted on 2004-08-06
8
983 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
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…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …

747 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

13 Experts available now in Live!

Get 1:1 Help Now