Results 1 to 2 of 2

Thread: VB pgm won't close

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2000
    Posts
    12
    My vb pgm runs multiple queries and a report from within an
    Access mdb but I can't get the vb pgm to close automatically when it's done. I have to click the close (X) button on the form to end it.
    Any ideas?

    On Error GoTo error1

    'Center form on screen
    Left = (Screen.Width - Width) \ 2
    Top = (Screen.Height - Height) \ 2

    Set msacs = New Access.Application
    msacs.OpenCurrentDatabase "F:\User Files\holly\Access\Expediting.mdb"
    msacs.Visible = False

    msacs.DoCmd.RunMacro "RunReport"
    msacs.CloseCurrentDatabase

    Unload Me

    error1:


  2. #2
    Guru Clunietp's Avatar
    Join Date
    Oct 1999
    Location
    USA
    Posts
    1,844
    Assuming msacs is an instance of an Access Application object, put this at the end of your code

    set msacs = nothing

    to release the object reference to the application object

Posting Permissions

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



Click Here to Expand Forum to Full Width