none
Alternative for SHELL() RRS feed

  • Question

  • Because our business decision to disable SHELL() command in the MS Access, I use SHELL() to run another MS Access application. I would like to know are there any alternative to run another MS Access application without SHELL()

    Your help and information is great appreciated,

    Regards,

    Sourises,


    • Edited by sourises Friday, January 12, 2018 9:02 PM
    Friday, January 12, 2018 8:33 PM

Answers

All replies

  • You can use the ShellExecute API function call:

    http://www.pptfaq.com/FAQ00479_ShellExecute_Example.htm


    Paul ~~~~ Microsoft MVP (Visual Basic)

    • Marked as answer by sourises Tuesday, January 16, 2018 6:57 PM
    Friday, January 12, 2018 9:05 PM
  • You can launch any pdf, excel, Access, word etc. by using this syntax:

    Application.FollowHyperlink   “full path to file name to launch”

    So the above works for any application – not limited to just access.

    Regards,

    Albert D. Kallal (Access MVP 2003-2017)

    Edmonton, Alberta Canada

    Friday, January 12, 2018 9:40 PM
  • In addition to the above, you can use OLE automation to create another instance of Access, open a different database in that instance, and do pretty much anything in that database.

    Dirk Goldgar, MS Access MVP
    Access tips: www.datagnostics.com/tips.html

    Friday, January 12, 2018 10:02 PM
  • Because our business decision to disable SHELL() command in the MS Access, I use SHELL() to run another MS Access application. I would like to know are there any alternative to run another MS Access application without SHELL()

    Hi sourises,

    What is the relation between the two Access applications? Are they independant of each other? Or do you wat to visit the tables? Or the code?

    When they are independant, then you can start 2 applications on the OS-level.

    Imb.

    Friday, January 12, 2018 11:14 PM
  • What about something like

    'Call OpenDb("C:\Users\Test\Documents\MyDatabase.accdb")
    Public Function OpenDb(sDb As String)
        Dim oAccess               As Object    'Access.Application
    
        On Error GoTo Error_Handler
    
        Set oAccess = CreateObject("Access.Application")    'Create a new Access instance
        With oAccess
            .OpenCurrentDatabase sDb    'Open the specified db
            .Visible = True
            .UserControl = True
            '.DoCmd.OpenForm "YourFormName"    'Open a form?
        End With
    
    Error_Handler_Exit:
        On Error Resume Next
        If Not oAccess Is Nothing Then Set oAccess = Nothing
        Exit Function
    
    Error_Handler:
        MsgBox "The following error has occured" & vbCrLf & vbCrLf & _
               "Error Number: " & Err.Number & vbCrLf & _
               "Error Source: OpenDb" & vbCrLf & _
               "Error Description: " & Err.Description & _
               Switch(Erl = 0, "", Erl <> 0, vbCrLf & "Line No: " & Erl) _
               , vbOKOnly + vbCritical, "An Error has Occured!"
        Resume Error_Handler_Exit
    End Function


    Daniel Pineault, 2010-2017 Microsoft MVP
    Professional Support: http://www.cardaconsultants.com
    MS Access Tips and Code Samples: http://www.devhut.net

    Sunday, January 14, 2018 12:28 AM
  • Hi there,

    Could you give us some more info on your "other" application.  Any of the suggested alternatives above would work, but you might already have that other one open some of the methods proposed would open another instance of Access.  If you wish you could check out my new website (http://forestbyte.com/) where you can download a module from the VBA samples page to switch to another Access instance.

    Vlad

    Sunday, January 14, 2018 6:36 PM
  • Hello sourises,

    What's the current statue of the issue? Has your original issue been resolved now? If it has, I would suggest your mark helpful reply or share your solution and mark it to help other developers who gets the same issue use this forum efficient. If not, please feel free to let us know your current issue.

    Best Regards,

    Terry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, January 15, 2018 7:24 AM
  • Thanks a million for the information and helping,

    I use Paul P Clement IV solution and it works for me,

    Thanks again for helping,

    Regards,

    Sourises

    Tuesday, January 16, 2018 6:59 PM