Error 8577 "Failed to get .... in VB6
Dear All ,
I can successfully show the datareport 1st time when i run the program.but the next time I if I try to show the report,it gives error 8577!!
but if I close(END) the Program & rerun again, the error is gone,again for 1st time.
Please help
Rahul
Re: Error 8577 "Failed to get .... in VB6
Then, you probably are not CLOSING the DB connection properly... Show the code you use.
Re: Error 8577 "Failed to get .... in VB6
Code:
Private Sub cmdprint_Click()
'Report.DiscardSavedData
Set rs = New ADODB.Recordset
Set con = New ADODB.Connection
con.Open (Constring)
'Unload Me
If DataEnvironment1.Bill.State = 1 Then
DataEnvironment1.Bill.Close
End If
DataEnvironment1.Bill.Open
billrpt.Sections("Head1").Controls.Item(1).Caption = "" + CStr(billno)
billrpt.Sections("Head1").Controls.Item("Label19").Caption = "Mr./Mrs." & customer
billrpt.Sections("Head1").Controls.Item("Label20").Caption = "Dr." & StrConv(CmbDr.Text, vbProperCase)
Refresh
'MsgBox (StrConv(CmbDr.Text, vbProperCase))
'billrpt.PrintReport showdialog, rptRangeAllPages
'DataEnvironment1.customer
'billrpt.PrintReport ShowDialog, rptRangeAllPages
billrpt.Show vbModal
billrpt.ExportReport rptKeyText, "D:\Invoice Number " & CStr(billno), True, rptRangeAllPages
cmdsave.Enabled = False
cmdprint.Enabled = False
billno = billno + 1
customer.Text = ""
CmbDr.Text = ""
If DataEnvironment1.Bill.State = 1 Then
DataEnvironment1.Bill.Close
Refresh
End If
End Sub
Re: Error 8577 "Failed to get .... in VB6
when finished with the dataset where are you closing CON.....
you need a con.close when done...
Re: Error 8577 "Failed to get .... in VB6
Thanks Gremlin,
Was it that small wee problem?
I had worried so much about it..heh heh
Thank you brother.
1 Attachment(s)
Re: Error 8577 "Failed to get .... in VB6
Dear Gremlin
Badluck.!!
It happened again even after putting con.close at the end.
Rahul
Attachment 31627
Re: Error 8577 "Failed to get .... in VB6
I typed at the end:
set rs=nothing
set con=nothing
Re: Error 8577 "Failed to get .... in VB6
just before that add..
rs.close
con.close
best to close it before you set it to nothing......
Re: Error 8577 "Failed to get .... in VB6
I typed at the end:
rs.close
con.close <<- operation not allowed when the connection is closed.!!! Error msg.
Re: Error 8577 "Failed to get .... in VB6
It seems that gremlin is offline. So no help until someone really helps !!!
Dglienna I wait for your inputs.
Thanks
Rahul
Re: Error 8577 "Failed to get .... in VB6
Quote:
Originally Posted by
dsrahul
I typed at the end:
rs.close
con.close <<- operation not allowed when the connection is closed.!!! Error msg.
So am I correct in assuming that you put that after the line that sets con to nothing? That would be a problem.
It would appear that your routine is not using Con nor RS so not sure why they are even there. More likely it is the data environment or the report that is triggering the error. Would help a lot if you showed us what line the error is thrown on and tell us the actual error message rather than the number which we would have to look up.
2 Attachment(s)
Re: Error 8577 "Failed to get .... in VB6
Quote:
Originally Posted by
DataMiser
So am I correct in assuming that you put that after the line that sets con to nothing? That would be a problem.
It would appear that your routine is not using Con nor RS so not sure why they are even there. More likely it is the data environment or the report that is triggering the error. Would help a lot if you showed us what line the error is thrown on and tell us the actual error message rather than the number which we would have to look up.
This is the line which is marked in yellow:
billrpt.ExportReport rptKeyText, "D:\Invoice Number " & CStr(billno), True, rptRangeAllPages
and the error Msg is:
Attachment 31633
Attachment 31635
Re: Error 8577 "Failed to get .... in VB6
Well I do not use the data environment nor do I use the VB report tools. I use Active Reports instead which works very well and makes it a bit hard for me to advise using those objects in VB. However
Code:
billrpt.Show vbModal
billrpt.ExportReport rptKeyText, "D:\Invoice Number " & CStr(billno), True, rptRangeAllPages
At a quick glance I am seeing something here that may be trying to Export data from your report after the report has been closed and would therefore fail I would think.
Of course I do not see the rest of the code and maybe you have something in there that hides the report rather than closing it when the user is done with it but the modal call will halt the code just before the export and wait for the form to either be hidden or closed before the next line is allowed to execute and of course if it is closed then whatever data was there is not there any longer.
Re: Error 8577 "Failed to get .... in VB6
Code:
billrpt.ExportReport rptKeyText, "D:\Invoice Number " & CStr(billno), True, rptRangeAllPages
The above mentioned line is just writing a textfile in the Harddrive..so that user is not bothered to click on save report etc.
I have debugged the entire process going on...
When I run the program 1st Time,no error comes out.keeping the same form open if I make another sale, the error fires.
I can give you Teamviewer ID & Password..Please come into my Computer & Check.
[Private info removed]
Re: Error 8577 "Failed to get .... in VB6
Sorry but I will not log into your computer. I have also removed the id and password from your post as that could open you up to all sorts of problems. NEVER post that kind of info on a public forum area unless you actually want someone to hijack your system.
But like I said I do not use the data environment in VB, never liked that nor the data controls nor the report tools that comes with it. Instead I always use ADO code for data handling and always use active reports for reporting functions.
The Modal part is the only thing there that jumps out at me and like I said unless you are preventing the form from being closed elsewhere before it returns control the the code shown I would expect it to crash on that very line you pointed out.
If it were an issue of it not being closed properly then I would expect the error to occur before it gets there unless there is something related to the .ExportReport method that needs to be cleaned up after calling it. You may want to check into that.