Turning on what is turned off in Startup

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.
 
A

Allen Browne

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
 
J

Joe Cilinceon

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
 
A

Allen Browne

So if you can get into your database, you can use the same code on
CurrentDb().
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top