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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Viewing Database Properties on Closed dbs

Status
Not open for further replies.

agfon

Programmer
Mar 25, 2005
38
US
I have found many examples of how to view the dbs properties on an open dbs. However, I cannot find any code showing how to view the properties of a dbs that is closed.

I would like to be able to view the properties without having to open the database.

Does anyone have any ideas?

Thanks.

-agfon
 
Hallo,

When a database is closed it is just a file, so has the same set of properties as any other file. To access any properties specific to an mdb file you have to open it as they are stored inside.

- Frink
 
Agfon: try something like:
Code:
Public Function gfPropertyValue( _
                strName As String, _
                strDatabase As String) _
                As Variant
                
    Dim dbs As DAO.Database, prp As DAO.Property

    Set dbs = OpenDatabase(strDatabase)
    gfPropertyValue = _
    dbs.Properties(Item:=strName).Value
    dbs.Close
    Set dbs = Nothing
End Function

Just run gfPropertyValue("AllowByPassKey","C:\database.mdb")

You would probably want to add some error handling to avoid getting the value of a non-existant property and all that.

But just as Frink says, running the code actually means opening the database. In the background that is, but still opening it.



"In three words I can sum up everything I've learned about life: it goes on."
- Robert Frost 1874-1963
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top