Solved

VB6, MS SQL 7, Crystal Report 9

Posted on 2003-11-09
6
441 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
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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 process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

713 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