Solved

Datareport - Failed getting Rowset(s) from current data source error is produced when I want to print the report two times.

Posted on 2004-10-26
660 Views
Last Modified: 2012-08-14
Problem:
I have a form that has two buttons on it: Print Preview and Print.
When I print preview this datareport it works fine. I can close the preview window and click Print Preview again to see it as many times as I wish.
If I click on the Print button, the complete report (All pages) prints out fine.
The problem occurs if I click on the Print button again in order to print out multiple reports, I get the following error: Failed getting Rowset(s) from current data source?

Code:
Private Sub butPrintPreview_Click()
        deEstimations.cmdHeader frmEstimationDesc.currentItem
        rptNoteFr.WindowState = 2
        rptNoteFr.Show vbModal, Me
        deEstimations.conEstimations.Close
        Set deEstimations = Nothing
End Sub
Private Sub butPrint_Click()
        deEstimations.cmdHeader frmEstimationDesc.currentItem
        rptNoteFr.WindowState = 2
        rptNoteFr.PrintReport (False)
        deEstimations.conEstimations.Close
        Set deEstimations = Nothing
End Sub

I don't know why it is doing this.
My Print Preview button works fine as many times as I would like it to. But not my Print button function?
0
Question by:dcprog
    4 Comments
     
    LVL 14

    Accepted Solution

    by:
    Hi
    Try by removing the statement
    >>Set deEstimations = Nothing
    ;-)
    Shiju
    0
     
    LVL 8

    Assisted Solution

    by:Ashutosh Vyas
    Set deEstimations = Nothing

    sets deEstimations to Nothing and therefore deEstimations.cmdHeader frmEstimationDesc.currentItem
    is noting and hense you get the error.
    0
     

    Author Comment

    by:dcprog
    Sorry guys.

    I tried removing the Set deEstimations = Nothing. The error is still occuring. What I don't understand is that the PrintPreview button works fine and it is basically the same? I never get that errror when I preview?

    A little more info on my DataEnvironment:

            1 DataEnvironment  (Mostly default settings)
            Name -> deEstimations

    1 DEConnection (Mostly default settings)
            Name -> conEstimations
            CommandTimetout -> 30
            ConnectionSource -> Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Estimations\DONNEE95.MDB;Persist Security Info=False
            ConnectionTimeout -> 15
            CursorLocation -> 3 - adUseClient
            DesignPromptBehaviour -> 2 - adPromptComplete
            DesingSaveAthentication -> False
            RunPromptBehaviour -> 2 - adPromptComplete
            RunSaveAuthentication -> False

    Many Commands and Child Commands
            All commands are based on an sql statement and have many child commands.


    Could this error be occuring because of these settings? Again I wouldn't understand why since the PrintPreview works fine.

    Let me know if you need more info.
    0
     

    Author Comment

    by:dcprog
    You guys were partially right about removing the Set deEstimation = Nothing statement.
    By removing this it still didn't work but after trying some stuff I discovered if add deEstimations.conEstimations.Open at the beginning of my command it worked.

    I did the same for my PrintPreview command. Now everything seems to be working fine.

    Thanks.
    0

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
    Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
    As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
    Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

    846 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now