Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to Close a database when the report is closed?!

Status
Not open for further replies.

MrKaM

Programmer
Jan 10, 2003
3
0
0
EU
Hi there,
I'm using MS-Report Designer to generate a report with VB6 Getting Data from .MDB database through ODBC connection.
The Problem is that the Database is still LOCKED! after the report is Closed..
Please help.. How to make sure that the Database is CLOSED when a report is closed using MS-Data-Report-Designer.

 
MrKaM,

If you are using Access, then you could put DoCmd.Quit
in the <OnClose> event of your report.

HTH,

krameje
 
krameje,
Do you mean like this?

Private Sub DataReport_QueryClose(Cancel As Integer, CloseMode As Integer)

DoCmd.Quit

End Sub

AL Almeida
NT/DB Admin
&quot;May all those that come behind us, find us faithfull&quot;
 
do you mean datareports in vb6? do you use dataenvironment to connect to the database. if you do, then in the terminate event of the datareport, you need to unload or close the dataenvironment according to whether you loaded or opened it for the reporting purpose.

in the form from which you call the report,
if you passed parameters to the report you need to use open as &quot;dataenviornment1.connection1.open command1 param1,param2&quot;
and if you don't pass parameters then you need to load the dataenvironment as &quot;load dataenvironment1&quot; before report1.show

in the datareport's terminate event you need to give

either


Private Sub DataReport_Terminate()
Unload DataEnvironment1
End Sub


or

Private Sub DataReport_Terminate()
DataEnvironment1.connection1.close
End Sub

to close the connection
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top