Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21845

How to Close a connection!!!

$
0
0
hello guys...
i have a problem with my DataEnvironment1 and show my DataReport in my app
the code is:

Code:

DataEnvironment1.Connection1.ConnectionString = App.Path + "\db1.mdb"

  DataEnvironment1.rsCommand1.Open "select in_pay,in_pay_date,typein,std_nm from inmoney order by typein"
      DataReport1.Show

the problem is: when i press a Print button the report shows the data correctly but when i close it and try to reopen it again i face this error:

Run-time error 3705: this operation is not allowed when the object is open.

So.. i tried to write some codes to close the connection and recordset after terminate the report by:
Code:

With DataEnvironment1
          .rsCommand1.Close
        .Connection1.Close
End With

but i face this error:
Run-time error 3709: the connection cannot be uesd to perform this operation. It's either closed or invalid in this context.

Also i tried to close only one of the above Closes not both, but the same problem.

Please help me!!!!!!

Viewing all articles
Browse latest Browse all 21845

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>