Solved

Error loading DLL (CurrentProject.Connection)

Posted on 2004-08-06
8
1,024 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

 
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 51

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 51

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 51

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

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

635 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