Connecting Tech Pros Worldwide Help | Site Map

How to set Startup Properties in MDE?

 
LinkBack Thread Tools Search this Thread
  #1  
Old November 13th, 2005, 01:28 PM
deko
Guest
 
Posts: n/a
Default How to set Startup Properties in MDE?

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, 01:29 PM
Allen Browne
Guest
 
Posts: n/a
Default 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]


 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,840 network members.