Solved

VB6, MS SQL 7, Crystal Report 9

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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…

739 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