Thread: Logon Failed!
View Single Post
  #1 (permalink)  
Old March 3rd, 2005, 05:13 AM
VannAustin VannAustin is offline
Registered User
Join Date: Mar 2005
Location: , , Philippines.
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Logon Failed!


Please check out my code. I get this error when I 'CRViewer.ViewReport' is called.

Logon failed.
Details: ADO Error Code: 0x80030020
Source: MS OLE DB Service Components
Description: A share violation has occured

The code is pretty simple and basic. Is there anything missing or something I didn't declare?

Thanks a lot!


    Dim crxApp As New CRAXDRT.Application
    Dim crxRep As CRAXDRT.Report
    Dim crxDBTable As CRAXDRT.DatabaseTable
    Dim crxDB As CRAXDRT.Database
    Dim crxConn As CRAXDRT.ConnectionProperty


    Screen.MousePointer = vbHourglass


        If CBox.GetPrinterJobs(TReport.DeviceName) <= 2 Then
            Exit Do
        End If

    Select Case UCase(TReport.reportName)
        strFilename = "PDOSchedule"

        strFilename = "PDOCurrent"

    Case "PASTDUE_30DAYS"
        strFilename = "PDO30Days"

        strFilename = "PDOActive"

        strFilename = "PDOSuspended"

        strFilename = "PDOCancelled"

    Case "PASTDUE_ABC"
        strFilename = "PDOABCEmployees"

    End Select

    ' Open crystal report printjob and get number of parameters
    strFilename = UCase(App.Path & "\Reports\" & strFilename & ".rpt")
    strMessage = TPastDue.Message

    ' Open the report
    Set crxRep = crxApp.OpenReport(strFilename)

    ' Set database location
    Set crxDBTable = crxRep.Database.Tables(1)
    crxDBTable.Location = CBox.IniFileRead("Database", "Name")

    ' Pass parameters to report
    With crxRep.ParameterFields
        For i = 1 To .Count
            For j = 0 To .Count - 1
                If Trim(UCase(.Item(i).parameterFieldName)) = Trim(UCase(TReport.Parameters(j, 0))) Then
                    .Item(i).AddCurrentValue TReport.Parameters(j, 1)
                    Exit For
                End If
    End With

    ' Set printer settings
    With TReport
        crxRep.SelectPrinter .DriverName, .DeviceName, .Port
    End With

    ' Set selection formula
    If TReport.Filter <> "" Then
        crxRep.RecordSelectionFormula = TReport.Filter
    End If

    Screen.MousePointer = vbDefault

    With frmReportPreview.CRViewer
        .ReportSource = crxRep
    End With

Reply With Quote