Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

VB6, MS SQL 7, Crystal Report 9

Posted on 2003-11-09
6
Medium Priority
?
459 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
5 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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

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…
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 …
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

772 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