Report.RunModal seems to be dropping the record parameter

manthanomanthano Member Posts: 10
edited 2006-12-21 in Navision Attain
I'm passing a record to the report, but it seems to get dropped. Not sure why?? Here is the code from the debugger.

OnPush Code
CurrForm.SETSELECTIONFILTER(SalesCrMemoHeader);
SalesCrMemoHeader.COPY(Rec);
SalesCrMemoHeader.PrintRecords(TRUE)

PrintRecords Function in SalesCrMemoHeader
WITH SalesCrMemoHeader DO BEGIN
  COPY(Rec);

  IF "Shortcut Dimension 1 Code" = 'CONDITION A' THEN
    ReportSelection.SETRANGE(Usage,ReportSelection.Usage::"S.Cr.Memo")
  ELSE IF "Shortcut Dimension 1 Code" =  'CONDITION B' THEN
    ReportSelection.SETRANGE(Usage,ReportSelection.Usage::"S.Cr.Memo(B)");

  ReportSelection.SETFILTER("Report ID",'<>0');
  ReportSelection.FIND('-');
  REPEAT
    REPORT.RUNMODAL(ReportSelection."Report ID",ShowRequestForm,FALSE,SalesCrMemoHeader);
  UNTIL ReportSelection.NEXT = 0;
END;

Any ideas as to what the matter is with this code? I believe the majority of it is standard Navision, with the exception of the conditional report selection. When the report request form comes up the No. filter is blank. Thanks!

Comments

  • kinekine Member Posts: 12,562
    Try to not use the "WITH" command. Are you sure, that nav will represent the code
      COPY(Rec);
    

    correctly as
      SalesCrMemoHeader.COPY(Rec);
    

    ???
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • manthanomanthano Member Posts: 10
    Based on the debugger, the Report.RunModal function is filled with all the correct values. But I will try your suggestion. Thanks.

    Edit: Tried doing it without using WITH. No difference. Thanks again for trying though.
Sign In or Register to comment.