CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 15 of 15

Hybrid View

  1. #1
    Join Date
    Apr 2006
    Location
    Kolkata, India
    Posts
    278

    Arrow 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


  2. #2
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: Error 8577 "Failed to get .... in VB6

    Then, you probably are not CLOSING the DB connection properly... Show the code you use.
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  3. #3
    Join Date
    Apr 2006
    Location
    Kolkata, India
    Posts
    278

    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
    Last edited by GremlinSA; July 26th, 2013 at 06:59 AM.

  4. #4
    Join Date
    Jun 2005
    Location
    JHB South Africa
    Posts
    3,772

    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...
    Articles VB6 : Break the 2G limit - Animation 1, 2 VB.NET : 2005/8 : Moving Images , Animation 1 , 2 , 3 , User Controls
    WPF Articles : 3D Animation 1 , 2 , 3
    Code snips: VB6 Hex Edit, IP Chat, Copy Prot., Crop, Zoom : .NET IP Chat (V4), Adv. ContextMenus, click Hotspot, Scroll Controls
    Find me in ASP.NET., VB6., VB.NET , Writing Articles, My Genealogy, Forum
    All VS.NET: posts refer to VS.NET 2008 (Pro) unless otherwise stated.

  5. #5
    Join Date
    Apr 2006
    Location
    Kolkata, India
    Posts
    278

    Re: Error 8577 "Failed to get .... in VB6

    Dear Gremlin
    Badluck.!!
    It happened again even after putting con.close at the end.
    Rahul
    Name:  Error.JPG
Views: 1703
Size:  53.4 KB

  6. #6
    Join Date
    Apr 2006
    Location
    Kolkata, India
    Posts
    278

    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.

  7. #7
    Join Date
    Apr 2006
    Location
    Kolkata, India
    Posts
    278

    Re: Error 8577 "Failed to get .... in VB6

    I typed at the end:
    set rs=nothing
    set con=nothing

  8. #8
    Join Date
    Jun 2005
    Location
    JHB South Africa
    Posts
    3,772

    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......
    Articles VB6 : Break the 2G limit - Animation 1, 2 VB.NET : 2005/8 : Moving Images , Animation 1 , 2 , 3 , User Controls
    WPF Articles : 3D Animation 1 , 2 , 3
    Code snips: VB6 Hex Edit, IP Chat, Copy Prot., Crop, Zoom : .NET IP Chat (V4), Adv. ContextMenus, click Hotspot, Scroll Controls
    Find me in ASP.NET., VB6., VB.NET , Writing Articles, My Genealogy, Forum
    All VS.NET: posts refer to VS.NET 2008 (Pro) unless otherwise stated.

  9. #9
    Join Date
    Apr 2006
    Location
    Kolkata, India
    Posts
    278

    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.


  10. #10
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: Error 8577 "Failed to get .... in VB6

    Quote Originally Posted by dsrahul View Post
    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.
    Always use [code][/code] tags when posting code.

  11. #11
    Join Date
    Apr 2006
    Location
    Kolkata, India
    Posts
    278

    Re: Error 8577 "Failed to get .... in VB6

    Quote Originally Posted by DataMiser View Post
    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:
    Name:  2ndrun.jpg
Views: 1591
Size:  101.8 KB
    Name:  1stRun.JPG
Views: 1530
Size:  28.8 KB

  12. #12
    Join Date
    Apr 2006
    Location
    Kolkata, India
    Posts
    278

    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

  13. #13
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    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.
    Always use [code][/code] tags when posting code.

  14. #14
    Join Date
    Apr 2006
    Location
    Kolkata, India
    Posts
    278

    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]
    Last edited by DataMiser; July 27th, 2013 at 01:52 AM. Reason: Removed private info

  15. #15
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    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.
    Always use [code][/code] tags when posting code.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured