Issue with objAccess.Quit -- Need Help!!!!

Discussion in 'C#' started by GoDoTrance, Apr 23, 2008.

  1. #1
    I have an ASP page that I have built that connects to an Access Database. In the connection I have set the objAccess.DoCmd.OpenReport so that as the query executes for each job, the page will generate report pages based on the number of jobs that I am passing into the Db.
    The problem that I have is the client doesn't want this to take more than a minute to display the reports. There may be a time when 50 jobs are passed into the Db and each job contains its own Work Order which is basically the report. End result is 50 reports in acViewPreview and "Snapshot Format".
    When I use the "objAccess.Quit acQuitSaveNone" Access Constant the session is killed which is what I want but the reports take up to 3 minutes to generate for preview on their website. If I comment this line out it takes all of about 20 seconds for the redirect to take place and show the reports but the session remains open and I have to kill it manually.
    Is there a way to speed this up, or is there a way to kill the session on the new page that I redirect to that displays the reports?
    I have been working on this for 4 days now. HHHHEEEELLLLPPPP!!!!!!!!
     
    GoDoTrance, Apr 23, 2008 IP
  2. jon32000

    jon32000 Active Member

    Messages:
    289
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    70
    #2
    hey i sent you a pm
     
    jon32000, Apr 23, 2008 IP
  3. GoDoTrance

    GoDoTrance Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Hey all. I found the answer to my own question. I was setting the following:

    Set objAccess = Server.CreateObject("Access.Application")
    objAccess.Visible = False
    objAccess.OpenCurrentDatabase Server.MapPath(DbPath),False,"OurPassword"
    Set objDB = objAccess.CurrentDb()
    objAccess.DoCmd.OpenReport reportName, acViewPreview, , strWhere
    objAccess.DoCmd.OutputTo acOutputReport, reportName, "Snapshot Format", Server.MapPath("\Database") & "\snapfiles\" & Session("Username") & "\" & reportName & ".snp"
    objAccess.Quit acQuitSaveNone
    Set objAccess = Nothing

    What I was doing was opening a database connection in the objAccess.OpenCurrentDatabase line but I never closed the current database. I changed the following;

    objAccess.Quit acQuitSaveNone
    to
    objAccess.CloseCurrentDatabase

    This has allows for the report to run much quicker and it does close the database session.
     
    GoDoTrance, Apr 23, 2008 IP