I received an old source code from the client and now he wants me to analyze and make it work again. I resolved 90% of the issues, but when I try to launch the crystal report, it shows me an error with not much information.
I am using VB6 with Crystal Report 8
This is the VB function where I am getting error
Private Sub cmdPrint_Click()
Screen.MousePointer = vbArrowHourglass
db.Execute ("Delete from TempReports")
db.Execute ("Delete from TempReports1")
With vsFlx
For I = 1 To .Rows - 1
db.Execute ("insert into TempReports (field1,field2,field3,field4,field5,field6,field7,field8, field19,field20,field14,field15,field16,field17,field18,field13,field21,field22) values ('" & .TextMatrix(I, 0) & "','" & .TextMatrix(I, 1) & "','" & .TextMatrix(I, 2) & "','" & .TextMatrix(I, 3) & "','" & .TextMatrix(I, 4) & "','" & .TextMatrix(I, 5) & "','" & .TextMatrix(I, 6) & "','" & .TextMatrix(I, 7) & "','" & MaskStartDate.Text & "','" & MaskEndDate.Text & "','" & fixquotes(lblItemGroup.Caption) & "','" & fixquotes(lblSubGroup.Caption) & "','" & fixquotes(lblSubsubGroup.Caption) & "','" & fixquotes(lblItemName.Caption) & "','" & fixquotes(lblMainItemName.Caption) & "'," & Val(txtBalanceQty) & ",'" & lblTotQtyIn.Caption & "','" & lblTotQtyOut.Caption & "') ")
Next
End With
With vsFlx2
For I = 1 To .Rows - 1
db.Execute ("insert into TempReports1 (field1,field2,field3,field4,field5,field6,field7,field8, field19,field20) values ('" & .TextMatrix(I, 0) & "','" & .TextMatrix(I, 1) & "','" & .TextMatrix(I, 2) & "','" & .TextMatrix(I, 3) & "','" & .TextMatrix(I, 4) & "','" & .TextMatrix(I, 5) & "','" & .TextMatrix(I, 6) & "','" & .TextMatrix(I, 7) & "','" & MaskStartDate.Text & "','" & MaskEndDate.Text & "') ")
Next
End With
crpt.ReportFileName = "reports\StockLedger.rpt"
crpt.SQLQuery = "Select * from TempReports order by id"
crpt.DiscardSavedData = True
crpt.WindowShowPrintSetupBtn = True
crpt.Action = 2
crpt.Destination = crptToWindow
Screen.MousePointer = vbDefault
End Sub
Getting error on this particular line
crpt.Action = 2
Screenshots for reference
any help is highly appreciated
UPDATE 1 I tried error handling and then I got following error message
UPDATE 2
Tried to register crpe32.dll and dwmapi.dll as suggest by craig but getting these errors
I fixed this issue by reinstalling everything. I was running this project on Virtual Machine. So, reinstalling OS and everything fixed the issue.
I think I might messed up something by installing external dlls or replacing existing ones.