How to know in an MS Access database if its an MDE

J

Johann Schwarz

Hi all !
I have some code in my Mdb, which opens design mode does some changes and
closes it again. The program in the end is compiled to an mde. In that case
this obviously doesn't work, so I want to prevent the user for using this in
the mde version. Is there any possibility to Check by code if the mdb is
still an mdb or if its a compiled version as an mde. Or is it possible to
allow the user to open design mode in a compiled mde.

Thx for comments

Johann Schwarz
 
G

Guest

Hi.

First, I would ask why this code is available for the users to run in the
first place. Not knowing anything about your database I can't say for sure,
but you may want to re-think your design.

Second, try this:
Right(CurrentDb.Name,3)

-Michael
 
D

Douglas J. Steele

Sorry, but that's a pretty unreliable test. The file can be named anything:
it doesn't have to be MDB or MDE.

You can look for the MDE property of the database object
(CurrentDb.Properties!MDE), which will be the letter "T" in an MDE, and
which will not exist in the non-MDE.

(Note that looking for a property that doesn't exist will generate an error,
so your code has to be able to handle that error)

In other words, you could have a function like this that will return True if
the current database is an MDE, and False otherwise:

Function IsMDE(DatabaseObject As DAO.Database) As Boolean
On Error Resume Next

IsMDE = (DatabaseObject.Properties!MDE = "T")

End Function

You'd call this as IsMDE(CurrentDb)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

mdb looks and acts like mde 3
setting up the printer in a mde 3
Why does an mde increase in size? 8
Access 2007 with a 2003 mde and Error 3734 2
Access 2007 and MDE 1
Access 2007 and MDE Files 1
mde 5
MDE File 1

Top