Has anyone tried to control the database container on startup? I would like to get the Tables tab to show as default. Instead, it opens to wherever I left it.
Any ideas would be greatly appreciated.
Cecilia
![]() |
Patch reliability is unclear. Unless you have an immediate, pressing need to install a specific patch, don't do it. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Database Container on Startup (Access 97 on Win 98)
Okay, I modified this code to identify whether the user is an admin (if so, show the db container) or an end user (don’t show container & just run the code): [If you’re an admin, you have a shortcut with Admin in the command line]
Function CheckCommandLine()
‘ Check value returned by Command function.
If Command = “Admin” Then
SetStartupProperties True
Else
If SetStartupProperties(False) = True Then
UpdateUsers ‘automatically run update code
End If
End If
End Function
Function SetStartupProperties(blnProtected As Boolean) As Boolean
SetStartupProperties = False
ChangeProperty “StartupShowDBWindow”, dbBoolean, blnProtected
ChangeProperty “StartupShowStatusBar”, dbBoolean, blnProtected
ChangeProperty “AllowBuiltinToolbars”, dbBoolean, blnProtected
ChangeProperty “AllowFullMenus”, dbBoolean, blnProtected
ChangeProperty “AllowBreakIntoCode”, dbBoolean, False
ChangeProperty “AllowSpecialKeys”, dbBoolean, False
ChangeProperty “AllowBypassKey”, dbBoolean, True
SetStartupProperties = True
End Function
Function ChangeProperty(strPropName As String, varPropType As Variant, varPropValue As Variant) As Integer
On Error GoTo HandleError
Dim db As Database
Dim prp As Property
Const conPropNotFoundError = 3270
Set db = CurrentDb()
db.Properties(strPropName) = varPropValue
ChangeProperty = True
Exit Function
HandleError:
Select Case Err
Case conPropNotFoundError
Set prp = db.CreateProperty(strPropName, varPropType, varPropValue)
db.Properties.Append prp
Resume Next
Case Else
ChangeProperty = False
MsgBox Err.Number & ” ” & Err.Description, , “Change Property Error”
End Select
End Function
The problem is whether or not the container properties are set up properly….If I open the database with the admin shortcut, the first time the container will be locked down and won’t show, but the end user code won’t run. The second time I open it, the container will be (properly) open.
If I open the db without the Admin command line, the opposite happens the first time (the container improperly shows), but the end user code (properly) runs. The second time around the container properly is hidden.
As a side note, for some reason the default toolbar _always_ shows when you run the db as an end user (without the admin line).
So what I’m dealing with is a delay in when the properties are effective for the database. Any ideas? Please? I’m going nuts about now & need to get this darned thing out the door.
Cecilia
Have you resolved your problem yet? I missed this question for some reason, and I discovered it today when I did a search for a similar issue. I believe this is an issue of properties not existing in the database until they are created – at least I have seen other posts relating to the issue of disabling the SHIFT key so people can’t bypass the startup process. You may want to set all the properties in the Tools/Startup dialog so that by default everything is protected, and then check security and turn them on if the user is the admin account. Repost if you are still stuck and I’ll try to help.
Hi Wendell–
Actually, this is exactly what I was trying to do. I locked down the db and then if the user was an Admin, opened it up. Worked great in theory, but not in practice. No matter what I did, the toolbar showed up as a User (even though it was turned off in the startup options) and either did or didn’t show up as an Admin. To get the thing off my plate, I ended up doing something else altogether. But just to update you on that particular situation, I did read about doing it from the Startup dialog (ie. in a form), but that didn’t work either.
I’m just going to write it off as a MS “feature” and move on. I’m happier with the new design anyway.
Thanks for asking, & happy Valentine’s!
Cecilia
The other comments actually are correct – you are changing start-up properties, and since they only affect start-up, you won’t see them till the next time you start-up. You mentioned a new design – I’m curious how you solved the probem. I was going to suggest that you consider giving the admin users a different front-end than the normal users. Either that or shut off the SHIFT key over-ride and put a hidden control that could be clicked which would let Admin users get into the database in a design mode. Happy Valentine’s Day to you also.
The reason there seems to be a lag is because when you change the startup properties in code the changes do not take effect until the next time you open the mdb. In essence you are opening the mdb, the startup properties are read, you change the properties in your code, then the properties are read the next time you open the mdb. Clear as mud?
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.