Turning on what is turned off in Startup

  • Thread starter Thread starter Joe Cilinceon
  • Start date Start date
J

Joe Cilinceon

I have DoCmd.SelectObject acForm, , True for turning back on the Display
Database Window which is turned off in the Startup. What would it be for
Allow Full Menus and Allow Built in Toolbars.
 
If you are completely locked out, you can use another database to set these
properties. Just set the strDb to the fully qualified path name for your
applicaiton, and remove the quotes from the beginning of the lines you want
to change:


Option Compare Database
Option Explicit

Function StartupProps(bSet As Boolean)
Dim db As DAO.Database
Dim strDB As String
Dim strPrp As String
strDb = "C:\MyPath\MyFile.mdb"
Set db = OpenDatabase(strDB)

' Application.SetOption "Track Name AutoCorrect Info", bSet
' Application.SetOption "Perform Name AutoCorrect", bSet
' Application.SetOption "Log Name AutoCorrect Changes", bSet

' ChangeProperty db, "StartupForm", dbText, "Form1"
' ChangeProperty db, "StartupShowDBWindow", dbBoolean, bSet
' ChangeProperty db, "StartupShowStatusBar", dbBoolean, bSet
' ChangeProperty db, "AllowBuiltinToolbars", dbBoolean, bSet
' ChangeProperty db, "AllowBreakIntoCode", dbBoolean, bSet
' Call ChangeProperty(db, "AllowFullMenus", dbBoolean, bSet)
Call ChangeProperty(db, "AllowSpecialKeys", dbBoolean, bSet)
Call ChangeProperty(db, "AllowBypassKey", dbBoolean, bSet)

db.Close
Set db = Nothing
End Function

Function ChangeProperty(dbs As Database, strPropName As String, _
varPropType As Variant, varPropValue As Variant) As Integer
Dim prp As Property
Const conPropNotFoundError = 3270

On Error GoTo Change_Err
dbs.Properties(strPropName) = varPropValue
ChangeProperty = True
Debug.Print strPropName & " is " & varPropValue

Change_Bye:
Exit Function

Change_Err:
If Err = conPropNotFoundError Then ' Property not found.
Set prp = dbs.CreateProperty(strPropName, _
varPropType, varPropValue)
dbs.Properties.Append prp
Resume Next
Else
' Unknown error.
ChangeProperty = False
Resume Change_Bye
End If
End Function
 
Nope not locked out since I can hold down the Shift key when I open it. No I
just want the database to open not showing it. I have an Option button to
view the database files and there I would like to turn every thing back on.
I'll study what you gave me here Allen and thanks alot. g
 
Back
Top