The problem is not the MDE. It is certainly possible to set some of these
properties programmatically for an MDE.
However not all of these are properties of the Database object.
Some (such as the first one) are properties of the Application, so you to
set them like this:
Application.SetOption "Track Name AutoCorrect Info", False
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users -
http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"deko" <deko@nospam.com> wrote in message
news:4PmdnfiwmfZ064LeRVn-vw@comcast.com...[color=blue]
> I'm trying to set startup properties with code after I make an MDB into an
> MDE.
>
> I have this code in the startup form's Form_Open event:
>
> If IsItMde Then
>
> For Each var In Array("Perform Name AutoCorrect", _
> "Track Name AutoCorrect Info", "StartUpShowDBWindow", _
> "StartUpShowStatusBar", "AllowFullMenus", "AllowBuiltInToolbars", _
> "AllowToolbarChanges", "AllowSpecialKeys", "UseAppIconForFrmRpt", _
> "AllowBypassKey", "AllowShortcutMenus")
> Call SetStartupProperty(CStr(var), False)
> Next
>
> End if
>
> Function IsItMde will correctly identify if it's an MDE or not, and the
> properties will get set in an MDB (if I remove the If statement), but not
> in an MDE.
>
> Is this because it is not possible to set these options in an MDE? Should
> I just set them in the MDB before I create the MDE? Why else would the
> properties not set in an MDE?
>
> Here is the SetStartupProperty function:
>
> Public Function SetStartupProperty(strPropName As String, _
> varPropValue As Variant)
> On Error GoTo HandleErr
> Dim db As DAO.Database
> Dim prp As DAO.Property
> Dim varPropType As Variant
> Set db = CurrentDb
> Select Case strPropName
> Case "StartupForm", "AppTitle"
> varPropType = dbText
> Case Else
> varPropType = dbBoolean
> End Select
> db.Properties(strPropName) = varPropValue
> Exit_Here:
> On Error Resume Next
> Set db = Nothing
> Set prp = Nothing
> Exit Function
> HandleErr:
> Select Case Err.Number
> Case 3270 'property not found
> Set prp = db.CreateProperty(strPropName, _
> varPropType, varPropValue, True)
> db.Properties.Append prp
> Resume Next
> Case Else
> End Select
> Resume Exit_Here
> End Function[/color]