The company that uses AccPac 5.3A got a macro from another company that uses 5.4. The macro has a user form for entering parameters for a custom invoice report. The parameters are a start and end date, and a comma delimited list of ROUTES (Order Optional Field).
Even though these parameters are set in the code using SetParam, a Crystal "Enter Parameter Values" dialog pops up asking to enter the values for the reports when the PrintReport method is run.
What might be causing the SetParam not to set parameters (I assume this is why the dialog pops up)?
Here is the function:
I've stepped through the code to confirm there are values in the parameters, I've even printed the values in the Immediate window then copied & pasted them in the dialog box to confirm they were acceptable values (the report ran with these values).
I ran a Verify Database in Crystal and it said the following tables had changed: OEORDH, OEORDD, ICITEM, CSCOM, OEORDHO, ARRTA. I let it "fix" the report and tried using this modified version, put the dialog still pops up.
In Crystal I see that there is one other parameter field, CMPNAME, that is before all others. I don't see it used in the Select Expert, and it does not appear in the pop-up, so I don't know if it is used at all.
Even though these parameters are set in the code using SetParam, a Crystal "Enter Parameter Values" dialog pops up asking to enter the values for the reports when the PrintReport method is run.
What might be causing the SetParam not to set parameters (I assume this is why the dialog pops up)?
Here is the function:
Code:
Public Sub print_invoices(lc_routes As String)
Dim o_MenuID As String
Dim o_ProgramID As String
Dim o_PrintDestination As Integer
Dim o_DbLink As AccpacCOMAPI.AccpacDBLink
Dim o_Report As AccpacCOMAPI.AccpacReport
Dim o_PrintSetup As AccpacCOMAPI.AccpacPrintSetup
o_MenuID = Space(6)
o_ProgramID = Space(6)
o_PrintDestination = PD_PREVIEW
v_ReportName = "OE_INVOICES"
Set o_Report = ReportSelect(v_reportname, o_MenuID, o_ProgramID)
Set o_PrintSetup = GetPrintSetup(o_MenuID, o_ProgramID)
o_PrintSetup.Orientation = 1
o_PrintSetup.PaperSize = 1
o_PrintSetup.PaperSource = 15
o_Report.PrinterSetup o_PrintSetup
o_Report.SetParam "SDATE", Format(DTPSDate.Value, "YYYYMMDD")
o_Report.SetParam "EDATE", Format(DTPEDate.Value, "YYYYMMDD")
o_Report.SetParam "ROUTES", lc_routes
o_Report.NumOfCopies = 1
o_Report.Destination = o_PrintDestination
o_Report.PrintDir = ""
o_Report.PrintReport
End Sub
I've stepped through the code to confirm there are values in the parameters, I've even printed the values in the Immediate window then copied & pasted them in the dialog box to confirm they were acceptable values (the report ran with these values).
I ran a Verify Database in Crystal and it said the following tables had changed: OEORDH, OEORDD, ICITEM, CSCOM, OEORDHO, ARRTA. I let it "fix" the report and tried using this modified version, put the dialog still pops up.
In Crystal I see that there is one other parameter field, CMPNAME, that is before all others. I don't see it used in the Select Expert, and it does not appear in the pop-up, so I don't know if it is used at all.