Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Report parameters set in code, but pop-up appears anyways

Status
Not open for further replies.

JoeAtWork

Programmer
Jul 31, 2005
2,285
CA
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:
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.

 
I got the oerpt.ini file from the original location, and after copying it to the OE53A directory, the dialog no longer pops up.

Sorry for the premature post, I just found out about the oerpt.ini file.

 
Don't worry, everyone experiences premature posting at some stage.
CMPNAME is used by Accpac to pass the database, so you can write one report that works with different companies. There is a way to pass the selection criteria formula instead, so you do not have to edit the xxRPT.INI file.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top