Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2005
    Posts
    13

    AppActivate

    I have the following code to open a report in one Access application from another Access Application

    The code works as it should ,in that it opens the application and prints the report and then returns to the calling application. When I attempt to just display the report on the screen it flashes and then retruns to the calling application.

    When I add the AppActivate "Microsoft Access" line the report stays on the screen for review. Closing via the close button on the menubar the main screen of the called application comes up. Using the close button for that screen returns me to the calling application. However I get a run time error 5, "invalid call or argument" and AppActivate "Microsoft Access" is highlighted.

    Is there a solution to this problem.


    Private Sub Command9_Click()

    Dim appAccess As Access.Application
    Set appAccess = CreateObject("Access.Application")
    appAccess.OpenCurrentDatabase "h:\Job Costing.mdb", False
    appAccess.DoCmd.OpenReport "rptJobCommentReview", acViewPreview
    appAccess.DoCmd.Maximize
    AppActivate "Microsoft Access"
    appAccess.CloseCurrentDatabase


    appAccess.Quit acQuitSaveAll
    Set appAccess = Nothing

    End Sub

    Thanks

  2. #2
    Join Date
    Oct 2005
    Posts
    13

    AppActivate Answer

    After much searching found a solution.

    At the access help menu for OpenCurrentDatabase Method there is
    sample code to open an instance of access from an instance of access.

    I have tested it and it returns to the originating instance with out error.

    The code doesn ' t use appActivate which was causing the error stated in my original message.

Please reply to this thread with any new information or opinions.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums