• Database Container on Startup (Access 97 on Win 98)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Database Container on Startup (Access 97 on Win 98)

    Author
    Topic
    #366518

    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 smile

    Viewing 0 reply threads
    Author
    Replies
    • #568607

      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 smile

      • #570230

        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.

        • #570402

          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 smile

          • #570473

            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.

            • #570602

              Actually, that’s what I did–I scrapped the startup thing and gave the Admins a password protected hidden entrance. Not exactly what I was hoping for, but it functions for what I need.

              Thanks 😉

      • #570414

        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?

        • #570419

          Hee hee! Yeah, that’s evident. At least for some of the properties (If I open the db as a User, it lets me see the toolbar 100% of the time, whereas it should be at least 50% of the time). But this default changing properties for the next time is not what I want it to do. Oh, well.

    Viewing 0 reply threads
    Reply To: Database Container on Startup (Access 97 on Win 98)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: