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

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?
dcprogAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Shiju SasidharanAssoc Project ManagerCommented:
Hi
Try by removing the statement
>>Set deEstimations = Nothing
;-)
Shiju
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ashutosh VyasFounder, InitQubeCommented:
Set deEstimations = Nothing

sets deEstimations to Nothing and therefore deEstimations.cmdHeader frmEstimationDesc.currentItem
is noting and hense you get the error.
0
dcprogAuthor Commented:
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
dcprogAuthor Commented:
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.