Solved

VB6, MS SQL 7, Crystal Report 9

Posted on 2003-11-09
6
430 Views
Last Modified: 2010-05-03
Front end: VB
Back end: MS SQL 7
Report: Crystal Report 9

I am receiving the following error:

Details: Error Code: 0x800a0e78
Source: ADODB.Recordset
Description: Operation is not allowed when the object is closed.

You could download the program from:
www.bigcaterers.com.my/db/report.zip

I believe that the error is on this part of the code:

CRXReport.Database.LogOnServer "P2SODBC.dll", "CyberCafe", "master", "sa", "papa"

Cause I tried to find P2SODBC.dll on my drive its not available.

My code works well before I formatted and reinstall everything back on my hard disk. But now Im getting this error.

Your help is kindly appreciated.

Regards
Eugene


P.S Table created in MS SQL 7.

create table Account_Master
(
    Account_ID varchar(50) Primary Key,
    PC_ID varchar(50),
    Date_Initiated datetime,
    Date_Stoped datetime,
    Duration varchar(50),
    Billed money NULL,
    Days money NULL,
    Months money NULL,
    Years money NULL,
    Sort int    
)

0
Comment
Question by:eugene007
  • 3
6 Comments
 
LVL 1

Expert Comment

by:fsaims
Comment Utility
Hi Buddy I examined your code: -

If Len(Trim(Text1.Text)) > 0 And Len((Text2.Text)) > 0 And Len((Text3.Text)) = 0 Then


          Adodc1.Recordset.Close      'This Statment is generating error, because if Recordset is already closed, how can it re-close?
         
 Dim strSQL As String
          strSQL = "SELECT Account_ID,PC_ID,Date_Initiated,Date_Stoped,Duration,Billed FROM [Account_Master] WHERE Date_Initiated BETWEEN CONVERT(datetime, '" + Format(CDate(Text1.Text), "mm/dd/yy") + "', 1) AND CONVERT(datetime, '" + Format(CDate(Text2.Text) + 1, "mm/dd/yy") + "', 1)" + " ORDER BY CAST(Sort AS INTEGER) ASC"
          Adodc1.Recordset.Open strSQL, Adodc1.ConnectionString, 1, 3
     
          If Trim(Adodc1.Recordset.RecordCount) = 0 Then
              MsgBox "Not Matching Records Found", vbExclamation, "Record Error"
              Adodc1.Refresh
              Exit Sub
          End If


0
 

Author Comment

by:eugene007
Comment Utility
Private Sub Form_Load()
       
     Set conn = New ADODB.Connection
     Set rs = New ADODB.Recordset

     strConnect = "Provider=sqloledb;Network Library=DBMSSOCN;Password=sumbat31;Persist Security Info=True;User ID=sa;Data Source=127.0.0.1;Initial Catalog=master"
     conn.Open strConnect
     rs.Open "SELECT * FROM Account_Master", conn, adOpenKeyset, adLockBatchOptimistic
         
     Set CRXReport = CRXApplication.OpenReport("EarningsReport.rpt", 1)
     CRXReport.Database.LogOnServer "P2SODBC.dll", "CyberCafe", "master", "sa", "sumbat31"
     CRXReport.Database.SetDataSource rs, 3, 1
     CRXReport.DiscardSavedData
     CRViewer1.ReportSource = CRXReport
     CRViewer1.ViewReport
     
     rs.Close
     conn.Close
       
End Sub


well this part of the code that gets triggered first when I start my app :)
0
 

Author Comment

by:eugene007
Comment Utility
rs.Open "SELECT * FROM Account_Master", conn, adOpenKeyset, adLockBatchOptimistic

After this code, I tried putting this:

MsgBox rs.RecordCount

and it does specify the amount of record in my database.
0
 

Author Comment

by:eugene007
Comment Utility
well I found the solution:

Just have to remove the

conn.close
rs.close

and that will solve the problem in my coding.
0
 

Accepted Solution

by:
SpazMODic earned 0 total points
Comment Utility
PAQed, with points refunded (35)

SpazMODic
EE Moderator
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now