Connecting Tech Pros Worldwide Help | Site Map

How to set Startup Properties in MDE?

  #1  
Old November 13th, 2005, 02:28 PM
deko
Guest
 
Posts: n/a
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


  #2  
Old November 13th, 2005, 02:29 PM
Allen Browne
Guest
 
Posts: n/a

re: How to set Startup Properties in MDE?


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]


Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
Was the A97 runtime setup wizard in the ODE tools something MicroSoft begrudgingly offered? MLH answers 10 November 13th, 2005 12:41 PM
Startup, Tool Bars, Menu Bars, Shortcuts, DB Window, etc cefrancke@yahoo.com answers 7 November 13th, 2005 09:37 AM
How to create custom data migration query? deko answers 11 November 12th, 2005 10:56 PM
How to create custom data migration query? deko answers 11 November 12th, 2005 10:29 PM