Results 1 to 10 of 10
  1. #1
    2 Star Lounger
    Join Date
    Jul 2002
    Location
    Sacramento, CA
    Posts
    193
    Thanks
    3
    Thanked 1 Time in 1 Post

    Open Remote FE DB and Bypass Display Form

    Is there a way to remotely open, via vba, an FE database and bypass the specified Display Form (as if the Shift key was held down on a manual opening)?I've looked at Command line switches, but they don't seem to offer a solution. I'm currently using app.OpenCurrentDatabase where app has been set to the remote FE.

    Thanks,
    Marty

  2. #2
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts
    I read in one place that this achieves what you want, but nothing to say whether it worked.
    Application.EnableEvents = False

    There are two ways to display a startup form: specify a startup form, or run an autoexec macro and put the opening of the form in the macro.

    The second method provides a window to achieve what you want, using the cmd command line switch. This enables you to pass a value to the database, which you can check at startup, as described here.

    So your autoexec macro could call a function that checked the value of command, and use that to decide whether to show the startup form.
    Regards
    John



  3. #3
    2 Star Lounger
    Join Date
    Jul 2002
    Location
    Sacramento, CA
    Posts
    193
    Thanks
    3
    Thanked 1 Time in 1 Post
    Thanks John. Unfortunately I don't have the opportunity to modify the FE's to utilize the AutoExec approach.

    I'm using Access 2007 and it's not recognizing .EnableEvents. Is there a reference I need to include for this?:

    Marty

  4. #4
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts
    Quote Originally Posted by mcowen View Post
    I'm using Access 2007 and it's not recognizing .EnableEvents. Is there a reference I need to include for this?
    I now think Application.EnableEvents=false is an Excel thing and so is no use.

    I am wondering if there is another way to achieve what you want. What are you trying to achieve by opening the db, but bypassing the startup screen?
    Regards
    John



  5. #5
    2 Star Lounger
    Join Date
    Jul 2002
    Location
    Sacramento, CA
    Posts
    193
    Thanks
    3
    Thanked 1 Time in 1 Post
    I need to modify the properties of several controls on a FE form. I'm attempting to put together a small Access db which when Run would execute the updates. I'm bumping into the need to provide different localized formatting for the distributed FE. Rather than trying to put the logic in the FE to determine where its at, I thought a custom "localization" db would be the simpler way to go. The local FE installation procedure would be modified to include a step to run the customization db.

    In anticipation of being able to change to an AutoExec macro as you suggested, I've implemented that on a test FE. However, I'm having a problem dealing with the command line option. Here's my code:

    Dim appAccess As New Access.Application
    appAccess.OpenCurrentDatabase _
    filepath:=pdbPath & " /cmd NoAutoStart"

    If I don't include the command line option, the FE fires the AutoExec. I've tested the command line manually and it works ... AutoExec does not fire. However, the code as shown raises error 7866 - Microsoft Office Access can't open the database because it is missing, or opened exclusively by another user, or it is not an ADP file.

    Marty

  6. #6
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts
    Why not just totally replace the distributed FE?

  7. #7
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts
    /cmd NoAutoStart
    My understanding is that what comes after /cmd is just a piece of text that is passed to the opened db, and can be retrieved using the Command function.

    So why should this stop the Autoexec macro running?

    What I had in mind was that the Autoexcec macro would always run, and would call a function. The function would test the value of the Command function, then decide what needs to happen.
    Regards
    John



  8. #8
    3 Star Lounger HiTechCoach's Avatar
    Join Date
    Sep 2011
    Location
    Oklahoma City, OK
    Posts
    200
    Thanks
    0
    Thanked 31 Times in 30 Posts
    Marty,

    Does this mean you are not deploying the front end compiled (.mde or .accde)?

    Rather than trying to put the logic in the FE to determine where its at, I thought a custom "localization" db would be the simpler way to go.
    Sounds like a lot more work and lots of room for issues.My experience tells me that you are doing the most error prone and way.

    Your method will not allow you to deploy your front end compiled.

    FWIW: I would only deploy a front end compiled.


    Boyd Trimmell aka HiTechCoach
    Microsoft MVP - Access Expert


    Boyd Trimmell aka HiTechCoach (Access Information here)
    Microsoft MVP - Access Expert
    "If technology doesn't work for people, then it doesn't work."

  9. #9
    2 Star Lounger
    Join Date
    Jul 2002
    Location
    Sacramento, CA
    Posts
    193
    Thanks
    3
    Thanked 1 Time in 1 Post
    John,

    I believe that's exactly what I'm trying to do. My AutoExec calls a function which tests the value/s passed through the Command function. I've a couple of shortcuts setup, one with and one without the command line text. The AutoExec works as desired. The problem comes when I try to open the FE with appAccess.OpenCurrentDatabse. If I don't include my command line switch the code runs, but the AutoExec fires. When I include the command line switch I get the error I mentioned above.

    This is an inherited application and a low priority for me. It needs considerable work to put it in shape to be distributable as a complied FE which will run on the various platforms. The onsite folks are accustomed to following their to compile it.

  10. #10
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts
    If I don't include my command line switch the code runs, but the AutoExec fires. When I include the command line switch I get the error I mentioned above.
    I have been testing this out, and the same thing happens for me too!

    But this code does work, using Shell to open the other db.

    Code:
        Dim strPath As String
        Dim strdbName As String
        Dim strAccessPath As String
        Dim strCommand as string
        strPath = CurrentProject.Path
        If Right(strPath, 1) <> "\" Then
            strPath = strPath & "\"
        End If
        strdbName = "test3.mdb"
        strAccessPath = "C:\Program Files\Microsoft Office2010\Office14\MSACCESS.EXE"
        strCommand = "Nostartup"
        Shell strAccessPath & " " & strPath & strdbName & " /cmd " & strCommand
    Regards
    John



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •