Hi Guys my name is tejas m having the same problem i am trying to compile a billing project but it wont simply work gives Unhandled exception in SPBS.EXE(Program Name) (CRAXDRT.DLL) Access Violation 0xc some zeros and 5 i am posting the complete code of frmreports can anyone help me to figure out what's wrong i am new to programming


***********************here is the code

Option Explicit

Public strReport        As String
Public PK               As String
Public strYear          As String
Public blnPaid          As Boolean
Public strWhere         As String

Dim mTest As CRAXDRT.Application
Dim mReport As CRAXDRT.Report
Dim SubReport As CRAXDRT.Report
Dim mParam As CRAXDRT.ParameterFieldDefinitions

Public Sub CommandPass(ByVal srcPerformWhat As String)
    Select Case srcPerformWhat
        Case "Close"
            Unload Me
    End Select
End Sub

Private Sub Form_Load()
On Error GoTo err_Form_Load
    Dim mSubRep
    
    Set mTest = New CRAXDRT.Application
    Set mReport = New CRAXDRT.Report

    Select Case strReport
        Case "Customer Ledger"
            Set mReport = mTest.OpenReport(App.Path & "\Reports\rpt_Customer_Ledger.rpt")
            
            mReport.RecordSelectionFormula = strWhere
        Case "Collections"
            Set mReport = mTest.OpenReport(App.Path & "\Reports\rpt_Collections.rpt")
        Case "Receivables"
            Set mReport = mTest.OpenReport(App.Path & "\Reports\rpt_Receivables.rpt")
        Case "Payments"
            Set mReport = mTest.OpenReport(App.Path & "\Reports\rpt_Payments.rpt")
            
            mReport.RecordSelectionFormula = "{Payments.PaymentID} = " & PK
        Case "Subscription Details"
            Set mReport = mTest.OpenReport(App.Path & "\Reports\rpt_Subscription_Details.rpt")
            
            mReport.RecordSelectionFormula = "{qry_Subscription_Details.SubscriberNo} = '" & PK & "'"
        Case "Customers Report" 'Subscribers List
            Set mReport = mTest.OpenReport(App.Path & "rpt_Customers.rpt")
            
            mReport.RecordSelectionFormula = strWhere

            Set mParam = mReport.ParameterFields
            
            If frmRPTCustomers.Option1(2).Value = True Then
                mParam.Item(1).AddCurrentValue "Status: Disconnected"
            Else
                mParam.Item(1).AddCurrentValue ""
            End If
        Case "Overall Subscriber Summary"
            Set mReport = mTest.OpenReport(App.Path & "rpt_Overall_Subscriber_Summary.rpt")
            mReport.RecordSelectionFormula = "{Subscription_Details.InstallationDate} <= #" & strWhere & "#"
            
            Set SubReport = mReport.OpenSubreport("Type")
            SubReport.RecordSelectionFormula = "{qry_Subscriber_Summary_by_Type.InstallationDate} <= #" & strWhere & "#"
            
            Set mParam = mReport.ParameterFields
            mParam.Item(1).AddCurrentValue CDate(strWhere)
        Case "Billing"
            Set mReport = mTest.OpenReport(App.Path & "\Reports\rpt_Billing.rpt")
        
            Set mParam = mReport.ParameterFields
            Dim dDateIssued As Date
            
            dDateIssued = frmRPTBilling.dtpDate
            mReport.RecordSelectionFormula = strWhere
                       
            mParam.Item(1).AddCurrentValue DateSerial(Year(dDateIssued), Month(dDateIssued) + 1, 0)
            mParam.Item(2).AddCurrentValue dDateIssued
        Case "Monthly Subscriber Summary"
            Set mReport = mTest.OpenReport(App.Path & "\Reports\rpt_Monthly_Subs_Sum.rpt")
            
            Set mParam = mReport.ParameterFields

            'New Subscriber
            Set SubReport = mReport.OpenSubreport("NewSubscriber")
            SubReport.RecordSelectionFormula = "{qry_RPT_New_Subscriber.InstallationDate} IN " & strWhere

            'Reconnection
            Set SubReport = mReport.OpenSubreport("Reconnected")
            SubReport.RecordSelectionFormula = "{qry_RPT_Reconnected.ReconnectionDate} IN " & strWhere

            'Disconnection
            Set SubReport = mReport.OpenSubreport("Disconnected")
            SubReport.RecordSelectionFormula = "{qry_RPT_Disconnected.DisconnectionDate} IN " & strWhere

            mParam.Item(1).AddCurrentValue frmRPTMonthlySubsSum.dtpBegDate.Value
            mParam.Item(2).AddCurrentValue frmRPTMonthlySubsSum.dtpEndDate.Value
        Case "Collection Summary"
            Set mReport = mTest.OpenReport(App.Path & "\Reports\rpt_Collection_Summary.rpt")
            
            Set mParam = mReport.ParameterFields

            mReport.RecordSelectionFormula = strWhere
    
            mParam.Item(1).AddCurrentValue frmRPTCollSum.dtpBegDate.Value
            mParam.Item(2).AddCurrentValue frmRPTCollSum.dtpEndDate.Value
        Case "Disbursement Summary"
            Set mReport = mTest.OpenReport(App.Path & "\Reports\rpt_Disbursement_Summary.rpt")
            
            Set mParam = mReport.ParameterFields

            mReport.RecordSelectionFormula = strWhere
    
            mParam.Item(1).AddCurrentValue frmRPTDisburseSum.dtpBegDate.Value
            mParam.Item(2).AddCurrentValue frmRPTDisburseSum.dtpEndDate.Value
        Case "Statement of Income and Expenses"
            Set mReport = mTest.OpenReport(App.Path & "\Reports\rpt_Income_and_Expenses.rpt")
            
            Set mParam = mReport.ParameterFields

            'New Subscriber
            Set SubReport = mReport.OpenSubreport("Revenues")
            SubReport.RecordSelectionFormula = "{qry_RPT_Revenues.PaymentDate} IN " & strWhere

            'Reconnection
            Set SubReport = mReport.OpenSubreport("OperatingExpenses")
            SubReport.RecordSelectionFormula = "{qry_RPT_Operating_Expenses.Date} IN " & strWhere

            'Disconnection
            Set SubReport = mReport.OpenSubreport("Refund")
            SubReport.RecordSelectionFormula = "{qry_RPT_Refund.PaymentDate} IN " & strWhere

            mParam.Item(1).AddCurrentValue frmRPTStatementIncExp.dtpBegDate.Value
            mParam.Item(2).AddCurrentValue frmRPTStatementIncExp.dtpEndDate.Value
        Case "Disbursement History"
            Set mReport = mTest.OpenReport(App.Path & "\Reports\rpt_Disbursement_History.rpt")
            
            mReport.RecordSelectionFormula = "{Voucher.VoucherID} = " & PK
        Case "Subscriber Per Month"
            Set mReport = mTest.OpenReport(App.Path & "\Reports\rpt_Subscriber_Per_Month.rpt")
        End Select
    
    Screen.MousePointer = vbHourglass
    CR.ReportSource = mReport
    CR.ViewReport
    Screen.MousePointer = vbDefault
    
    Exit Sub
    
err_Form_Load:
    prompt_err err, Name, "Form_Load"
    Screen.MousePointer = vbDefault
End Sub

Private Sub Form_Resize()
    With CR
        .Top = 0
        .Left = 0
        .Height = ScaleHeight
        .Width = ScaleWidth
    End With
End Sub

Private Sub Form_Unload(Cancel As Integer)
    mdiMain.RemoveChild Me.Name
    
    Set frmReports = Nothing
End Sub

******************************************** end of code *************

thanks in advance for reply

Edited 4 Years Ago by Ezzaral: Added code tags. Please use them to format any code that you post.

hello there you know i seemed to have fixed it myself infact there was 14 report files in the source code when i compiled using pdw vb it did not copy those files that was giving that error thanks dani without this post this idea wouldn't have come to my mind to FORMAT THE CODE I MEAN CHECK IT AGAIN BEFORE COMPILE THANKS A TON

Glad you found the error. Sometimes the Package and Deployment Wizard (PDW) does not pick up all the dependencies and you have to add the files yourself.

Well formatted and well written code. For a beginner you have picked up some good habits. Keep up the good work.

This article has been dead for over six months. Start a new discussion instead.