|
-
Aug 14th, 1999, 12:11 PM
#1
Thread Starter
New Member
Hello everyone. I'm adding some reports to a vb program,using the Data Enviroment designer and Data Report designer. My problem is that I want to be able to set the data source of the connection at runtime ,since I need to use the App.Path & "\filename.mdb" syntax. I also want to be able to close the data enviroment so that onother part of my program can use the database exclusively. I tried something like this:
deMain.Connections("conMain").ConnectionString = "Provider=Microsoft.Jet.OLEDB.3.51;Persist Security Info=False;Data Source=" & gsDatabaseName
deMain.Connections("conMain").Open
deMain.Commands("comSort").CommandText = "SELECT ..." deMain.Commands("comSort").Execute
drpSort.Show vbModal ' this is the report
deMain.Connections("conMain").Close
This seems to work on the first time it is executed. The second time however,I get the error <i>The application requested an operation on an object with a reference to a closed or invalid Connection object.</i> The offending line is
deMain.Commands("comSort").Execute
I would like to be able to open the data connection just before I show the report ,and close it afterwards so that other parts of my program can have exclusive access to the database file.
Any help is greatly appreciated.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|