Hey everyone, I'm posting this for a co-worker. I tried to help her but I am at a loss and can't find anything in the forum like this.
Every time we I get to the point of printing, viewing or exporting we get the error message: Object Required... Each place it errors is in red.
Casper
There is room for all of gods creatures, "Right Beside the Mashed Potatoes".
Every time we I get to the point of printing, viewing or exporting we get the error message: Object Required... Each place it errors is in red.
Code:
Public Sub PrintRpt(frm As Form, prt As Integer)
Dim g_AppReport As CRAXDRT.Application
Dim g_Report As CRAXDRT.Report 'HOLDS REPORT
Dim j As Long
g_SERVERNM = "imnr"
c_DBNM = "imnr"
g_USERID = "imnrpt"
g_PASSWD = "imnrpt"
On Error GoTo CERR
Set g_AppReport = CreateObject("CrystalRuntime.Application")
Set g_Report = g_AppReport.OpenReport("C:\IMN.rpt")
g_Report.Database.LogOnServer "crdb_oracle.dll", g_SERVERNM, c_DBNM, g_USERID, g_PASSWD
For j = 1 To g_Report.Database.Tables.Count
g_Report.Database.Tables(j).SetLogOnInfo g_SERVERNM, c_DBNM, g_USERID, g_PASSWD
Next
g_Report.ParameterFields(1).SetCurrentValue frm.txtSD.Text, 12
g_Report.DisplayProgressDialog = False
g_Report.EnableParameterPrompting = False
If prt = 0 Then
[COLOR=red] g_Report.PrintOut[/color]
Else
If prt = 1 Then
[COLOR=red] frmIMN.CRViewer.ReportSource = g_Report[/color]
frmIMN.CRViewer.ViewReport 'LINK VIEWER TO REPORT IN frmIMN
frmIMN.Visible = True
Else
g_Report.ExportOptions.DiskFileName = c_DEXPPATH + "IMN_REPORTS\" + g_RptNM + frm.txtSD.Text + ".doc"
g_Report.ExportOptions.FormatType = 14
g_Report.ExportOptions.DestinationType = 1
[COLOR=red] g_Report.Export[/color]
frm.Refresh
End If
End If
While Not (g_Report.PrintingStatus.Progress = crPrintingCompleted)
DoEvents
Wend
Set g_Report = Nothing
Exit Sub
CERR:
If frm.Name = "frmIMN" Then
frmERR.lblErr.Caption = " Monthly Failed. Error: " + Err.Description
frmERR.lblAct.Caption = "Please Reprint Monthly manually. "
frmERR.Show vbModal
End If
Set g_Report = Nothing
Err.Raise Err.Number
End Sub
Casper
There is room for all of gods creatures, "Right Beside the Mashed Potatoes".