To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here
VBForums  

VB Wire News
Part 10 of the Visual Basic .NET 2010 Express Tutorial Complete!
How to Use the Visual Studio Code Analysis Tool FxCop
Article :: Interview with Andrei Alexandrescu (Part 3 of 3)
Introducing Visual Studio LightSwitch
Visual Studio LightSwitch Beta 1 is Available



Go Back   VBForums > Visual Basic > Visual Basic 6 and Earlier

Reply Post New Thread
 
Thread Tools Display Modes
Old Dec 23rd, 2005, 05:24 AM   #1
bomayed
Addicted Member
 
Join Date: Aug 05
Posts: 150
bomayed is an unknown quantity at this point (<10)
Very Strange Error in Datareport!!!

I placed a label on a datareport

Then I typed the following command

Private sub Command1_click()

Dim rs as new adodb.recordset
set rs=cm.execute("select sysdate from dual")
set datareport1.datasource=rs

datareport1.sections("section1").contorls.itme("label1").caption="HI"
datareport1.show

I run the program and I follow what it is doing by click on F8 , and every thing seams to be allright , I see the a report with the word HI in it.


Now when I click on the button , without breaking the code or pressing F8 , I get an error message saying ( Operation is not allowed when the object is closed!)


What is going on , can someone explain this to me ?
bomayed is offline   Reply With Quote
Old Dec 23rd, 2005, 06:48 AM   #2
BrailleSchool
PowerPoster
 
Join Date: Apr 05
Location: Debug.Print
Posts: 3,606
BrailleSchool will become famous soon enough (80+)
Re: Very Strange Error in Datareport!!!

Quote:
Originally Posted by bomayed
I placed a label on a datareport

Then I typed the following command

Private sub Command1_click()

Dim rs as new adodb.recordset
set rs=cm.execute("select sysdate from dual")
set datareport1.datasource=rs

datareport1.sections("section1").contorls.itme("label1").caption="HI"
datareport1.show

I run the program and I follow what it is doing by click on F8 , and every thing seams to be allright , I see the a report with the word HI in it.


Now when I click on the button , without breaking the code or pressing F8 , I get an error message saying ( Operation is not allowed when the object is closed!)


What is going on , can someone explain this to me ?
first you need to dim and set the recordset and connection to the database, then you open the recordset, do your sql query and then close the recordset and connection to the database. secondly, this like has a typo:
VB Code:
  1. datareport1.sections("section1").contorls.[b][color=red]itme[/color][/b][color=red][/color]("label1").caption="HI"
__________________
A+, e-Biz+, i-Net+, MCDST, MCP, Network+, Security+, A.A.S (Hons.)
Visual Basic .NET Video Tutorials | Login Form using backend database (.NET) | Useful site for sending email through .NET | Encrypt/Decrypt data in SQL Server 2005 using SQL statements | Writing Managed Stored Procedures in SQL Server 2005 | FREE .NET Calendar Control | Useful WinForm Controls | Regular Expression (Rexex) Library


What I am using:
Microsoft Visual Basic Professional 2005 with .NET Framework 2.0 and Microsoft SQL Server 2005 or MySQL
BrailleSchool is offline   Reply With Quote
Reply

Go Back   VBForums > Visual Basic > Visual Basic 6 and Earlier


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 05:23 AM.





Acceptable Use Policy

Internet.com
The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.