Solved

VB6, MS SQL 7, Crystal Report 9

Posted on 2003-11-09
6
449 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
6 Comments
 
LVL 1

Expert Comment

by:fsaims
ID: 9709848
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
ID: 9710078
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
ID: 9710085
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
ID: 9713773
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
ID: 9742881
PAQed, with points refunded (35)

SpazMODic
EE Moderator
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
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…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month6 days, left to enroll

627 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