Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with connection string 1

Status
Not open for further replies.

FancyPrairie

Programmer
Oct 16, 2001
2,917
US
I'm trying to retrieve the names of all of the tables and queries from another database (database A) using ADOX. It works fine if database A is not password protected. If it's password protected then it crashes with the "Don't Send" message. The connection string contains the name of the mdw file and the user id and password, I don't understand why it crashes if the db is password protected.

To test it, first create a database (LibraryDatabase.mdb), create a new modulue and copy and paste fooLib into the new module.

LibraryDatabase.mdb
Code:
Function fooLib()

    Dim cnn As ADODB.Connection
    Dim cat As ADOX.Catalog
    
    Set cnn = New ADODB.Connection
    Set cat = New ADOX.Catalog
  
    Set cnn = CurrentProject.Connection
        
    Set cat.ActiveConnection = cnn
    Stop

End Function

Note the Stop statement. You should be able to see the values of cat (i.e. cat.tables, etc).

Step 2: Create an unsecured database, and create a new module and insert the following code into it. Then set a Reference to the LibraryDatabase.mdb. Then run the following code. When it stops you should be able to examine cat.tables, etc.

TestDatabase_Unsecured.mdb
Set a reference to LibraryDatabase.mdb
Code:
Function foo()
  Call fooLib
End Function

Step 3: Create an secured database, and create a new module and insert the following code into it. Then set a Reference to the LibraryDatabase.mdb. Then run the following code. When it stops it should crash when you attempt to examine cat.tables, etc.

TestDatabase_Secured.mdb
Set a reference to LibraryDatabase.mdb
Code:
Function foo()
  Call fooLib
End Function
 
Did your secure database require both a user name and password?
 
Remou,

Thanks for taking the time to try it out. As a result of yours working I tried it on another one of my secured databases and it worked on that one. So it must be something with my database.

Thanks again for your time.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top