Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Error loading DLL (CurrentProject.Connection)

Posted on 2004-08-06
8
Medium Priority
?
1,034 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:Lucas
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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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 52

Accepted Solution

by:
Gustav Brock earned 2000 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 52

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 52

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
If you’re using QODBC to update QuickBooks data from Microsoft® Access but Access is not showing the updated data, you could have set up QODBC incorrectly.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

885 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