MDE Property
Applies To
Database object.
Description
You can use the MDE property to determine whether a database has been saved as an .mde file.
Setting
When a database is saved as an .mde file, Microsoft Access adds the MDE property to the database and sets it to the String value "T".
The MDE property can be determined only by using Visual Basic and is read-only in all views.
Important Trying to determine the MDE property for a database that hasn't been saved as an .mde file will generate run-time error 3270 (property not found). The MDE property doesn't exist in a database until the database is saved as an .mde file.
Remarks
You can convert a database to an .mde file by pointing to Database Utilities on the Tools menu and clicking Make MDE File. When you save a database as an .mde file, Microsoft Access removes all editable source code, compiles all modules, and compacts the database. Your Visual Basic code still works, but the code cannot be viewed or changed. In addition, you can't add or make changes to form or report objects.
Warning Be sure to retain a copy of your original database. If you need to change any code or the design of objects in an .mde database, you must do so in the original database and then create a new .mde database. You will also need the original database in order to convert to future versions of Microsoft Access because you can't directly convert .mde files.
Saving a database as an .mde file is most appropriate when you want to prevent changes to forms or reports, or hide your Visual Basic code from the database users. You could also convert a database to an .mde file when you create your own wizards or for the front-end portion of a front-end/back-end application.
A replicated database can't be saved as an .mde file; however, once a database is saved as an .mde file, it can be replicated.
Example
The following example uses the IsItMDE function to check the MDE property for the current database:
Dim dbs As Database
Set dbs = CurrentDb
If IsItMDE(dbs) <> True Then
' Process custom database code.
End If
Function IsItMDE(dbs As Database) As Boolean
Dim strMDE As String
On Error Resume Next
strMDE = dbs.Properties("MDE")
If Err = 0 AND strMDE = "T" Then
' This is an MDE database.
IsItMDE = True
Else
IsITMDE = False
End if
End Function