borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (Can Data Report)Next Topic (How Crystal Report 10.0 works with VB 6.0) New Topic New Poll Post Reply
AndreaVB Forum : Reporting tools : DataReport Object was Open?
Poster Message
luckyboy
Level: VB Lord

Registered: 05-05-2005
Posts: 160

icon DataReport Object was Open?

hi everyone . i wonder why my datareport  always 'Object was Open'?  it's kind of error   . i already close my connection before i open datareport. but the result still the same , here are my code at form:


    If Dt1.rstblCheckOutBill.State = adStateOpen Then
        D1.rstblCheckOutBill.Close
    End If
    Dt1.rstblCheckOutBill.Open "SELECT *, Days * Price AS    RoomCharge, OverTimes * ChargePerHour AS OTCharge FROM HtblCheckOut WHERE CheckID='" + Me.comCheckID + "'"


and this code at datareport

Private Sub DataReport_QueryClose(Cancel As Integer, CloseMode As Integer)
    If Dt1.rstblCheckOutBill.State = adStateOpen Then
        Dt1.rstblCheckOutBill.Close
    End If
End Sub


anyidea please.

____________________________
Please help out.

25-10-2005 at 01:27 AM
View Profile Send Email to User Show All Posts | Quote Reply
TJ_01
Level: VB Lord


Registered: 24-08-2005
Posts: 320
icon Re: DataReport Object was Open?

Are you using DataEnvironment?





[Edited by TJ_01 on 25-10-2005 at 05:40 AM GMT]

____________________________
Im JAMES  

25-10-2005 at 05:39 AM
View Profile Send Email to User Show All Posts | Quote Reply
luckyboy
Level: VB Lord

Registered: 05-05-2005
Posts: 160
icon Re: DataReport Object was Open?

yes, exactly. how can i sovle this problem? more help please

____________________________
Please help out.

27-10-2005 at 01:36 AM
View Profile Send Email to User Show All Posts | Quote Reply
TJ_01
Level: VB Lord


Registered: 24-08-2005
Posts: 320
icon Re: DataReport Object was Open?

Can you give me the specs of your report? I mean what do you want to do with your report? And also, can you post your existing code? It will be more easy for me to analyze.  

____________________________
Im JAMES  

27-10-2005 at 02:25 AM
View Profile Send Email to User Show All Posts | Quote Reply
luckyboy
Level: VB Lord

Registered: 05-05-2005
Posts: 160
icon Re: DataReport Object was Open?

ok. here the code in dataenvironment command(tblCheckOutBill):

SELECT *, Days * Price AS RoomCharge, OverTimes * ChargePerHour AS OTCharge FROM HtblCheckOut


and here the code in form that i call derectly to data report:

DataEnvironment1.rstblCheckOutBill.Open "SELECT *, Days * Price AS RoomCharge, OverTimes * ChargePerHour AS OTCharge FROM HtblCheckOut WHERE CheckID='" + Me.comCheckID + "'"
HdtrCheckOutBill.Show


and the last is the code in data report that i call from above. i need to close rstblCheckOutBill. right?

Private Sub DataReport_QueryClose(Cancel As Integer, CloseMode As Integer)
    If DataEnvironment1.rstblCheckOutBill.State = adStateOpen Then
        DataEnvironment1.rstblCheckOutBill.Close
    End If
End Sub


if i open it with the same record (CH00001), it's alway fine. but if i change record (CH00002), it's alway error(Object was open).       more please.


____________________________
Please help out.

27-10-2005 at 06:37 AM
View Profile Send Email to User Show All Posts | Quote Reply
TJ_01
Level: VB Lord


Registered: 24-08-2005
Posts: 320
icon Re: DataReport Object was Open?

Try this one:
In your form

  With DataEnvironment1
    If .rstblCheckOutBill.State = adStateOpen Then .rstblCheckOutBill.Close
  .rstblCheckOutBill frmDate.comCheckID.Value
  End With
  HdtrCheckOutBill.Show



In your dataEnvironment, then command1, right click and then properties. and then from the sql statement write this code:

SELECT HtblCheckOut. * FROM HtblCheckOut WHERE CheckID = ?

BTW, What specs of report you want? like field and etc. This code is a air coded and havent test becoz i dont have my vs intstalled.


HTH..

____________________________
Im JAMES  

27-10-2005 at 06:48 AM
View Profile Send Email to User Show All Posts | Quote Reply
AndreaVB Forum : Reporting tools : DataReport Object was Open?
Previous Topic (Can Data Report)Next Topic (How Crystal Report 10.0 works with VB 6.0) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder