Error in loading dll problem

penfold1992

Registered User.
Local time
Today, 11:40
Joined
Nov 22, 2012
Messages
169
I keep getting an error that says "Error Loading DLL"
vba then opens up and highlights this line...
Dim objConn As New ADODB.Connection

so I did a search to see what objConn was and found a little lower down it is referenced in...
objConn.Open ConnectionString
so I went looking at what ConnectionString was.

ConnectionString was in a Different module which is defined as such.

Code:
Public Property Get ConnectionString() As String
    Dim nConnectionString As String
    Dim mConnectionString As String
    Dim ThisYear As String
    
    ThisYear = Year(Now)
    mConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; " & _
                        "Data Source=---file location blanked for security---;"
    
    Debug.Print "name of database is..."
    
 '   nConnectionString = Replace(mConnectionString, "2012", ThisYear)
    ConnectionString = mConnectionString
    Debug.Print ConnectionString
End Property

this however is where I dont understand things... I dont understand why this is not working or acceptable?

I know the dll is a library file that is found in an access file which I must reference and I have done that.... so what is the problem?!?!
 
Do you have ADO objects listed as a checked reference in the VBA editor window?

VBA Editor \ Tools \ References \ Microsoft ActiveX Data Objects 2.8 Library should be checked / enabled to be able to use the basic ADO objects.
 
As the project is done at work, I am unable to view the references as it requires a "VBA Password" that I do not know. Its frustrating as I am not able to even check these for myself. The problem is that the raw file that I got this code from seems to work (some of the time)

Code:
Private Const mConnectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=--source removed--;Persist Security Info=False;Jet OLEDB:Database"
 
Public Property Get ConnectionString()
    Dim strConnection2011 As String
    ConnectionString = mConnectionString

This code works... but the other does not... well sometimes?
I dont know what the problem is but I am afraid to touch the file as it is now.
 

Users who are viewing this thread

Back
Top Bottom