report preview straight from button on form

krazy89krazy89 Member Posts: 30
Hey everyone..

i'm trying to run a report from a button on the sales order form and need to have the report run straight into preview mode.

I set all the filters on the report... but i just can't seem to get around displaying the request form for the report...

The reason i don't want to show the request form is because i don't want the user to be able to print the report.

If anyone can help. THanks,
KraZy

Comments

  • Luc_VanDyckLuc_VanDyck Member, Moderator, Administrator Posts: 3,633
    You can probably do this with SendKeys. Search this forum for "sendkeys" and you'll find some examples how to use it.
    No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)
  • SavatageSavatage Member Posts: 7,142
    krazy89 wrote:
    The reason i don't want to show the request form is because i don't want the user to be able to print the report.

    How important is it that they don't print the report.
    How about setting the reports printer in properties to some non existant printer? Is it because it's vital/confidential info?

    there's always print screen & paste

    Another post
    http://www.mibuso.com/forum/viewtopic.php?t=20877
  • krazy89krazy89 Member Posts: 30
    thanks for the quick reply...

    i was hoping there was a elaquent way... but from my searches on google... i guess this might be the only way???

    on a side note...

    if there's a report that reserves stock for an order.. and i don't need to preview it at all... and NOT print it... is there a way that i can just run the report with all the code behind it... and not show any preview or print it at all??

    Thanks,
    KraZy
  • SavatageSavatage Member Posts: 7,142
    edited 2007-10-16
    krazy89 wrote:
    if there's a report that reserves stock for an order.. and i don't need to preview it at all... and NOT print it... is there a way that i can just run the report with all the code behind it... and not show any preview or print it at all??
    Thanks,
    see the ProcessingOnly property

    This property is used to set whether a report will produce printed output, or will only be able to process data.

    view the properties of the blank underneath the last dataitem.

    *Edit*perhaps I read your question wrong
  • krazy89krazy89 Member Posts: 30
    hey savatage,

    it's vital that the report not get printed, because... i only want to reserve stock... and not produce a pick ticket because the ship date could be 6 months away... and i don't want a pick ticket floating around for 6 months... and definitely not want to double ship...

    Thanks,
    KraZy
  • SavatageSavatage Member Posts: 7,142
    does the Prcessingonly property help as stated above??
  • krazy89krazy89 Member Posts: 30
    that should be the trick... but is there a way of setting that property in the code??

    the report is being used in multiple areas now.. and in one instance.. i do need it printed out and in this instance... not to be printed out?

    THanks,
    KraZy
  • SavatageSavatage Member Posts: 7,142
    not sure but you could always make two buttons
    1) process order
    2) print order

    or use the VISIBLE trick to hide a button depending on some criteria.
    ie/ Some Checkbox or By User, Released or Open, etc etc.

    This will explain what i ment by VISIBLE
    http://www.geocities.com/navision_attai ... uttons.doc
  • krazy89krazy89 Member Posts: 30
    hmm... 2 buttons won't make a difference...

    if i change the properties on the pick ticket report... then when i need to print it... i won't be able to... i would have to make a duplicate report.. and set PROCESSINGONLY parameter different from the other one... that's kinda a waste of a report slot...

    i was thinking something like:

    PickTicket.PROCESSINGONLY(TRUE);

    but that doesn't work...

    Thanks,
    KraZy
  • SavatageSavatage Member Posts: 7,142
    krazy89 wrote:
    that's kinda a waste of a report slot...

    I basically falls into the "How important IS it" category. Only you can answer that.
  • krazy89krazy89 Member Posts: 30
    thanks for you help... i guess the only way around it is to have 2 reports... one that can be printed.. and one that is processingonly...

    tahnks,
    KraZy
  • Jonathan2708Jonathan2708 Member Posts: 552
    Hi,

    I did this once using the following code :
    WshShell      Automation  'Windows Script Host Object Model'.WshShell
    ReportFilter  Record
    objReport     Report	
    
    // Use Shell Automation Object To SendKeys To Request Form To Auto Preview
    CREATE(WshShell);
    
    // Run Report In Preview Mode, Skipping Request Form
    objReport.SETTABLEVIEW(ReportFilter);
    objReport.RUN;
    WshShell.SendKeys('%{v}'); // Same as Alt+V (Preview)
    CLEAR(WshShell);
    


    Hope that helps.

    Jonathan
  • SavatageSavatage Member Posts: 7,142
    Hi,

    I did this once using the following code :
    WshShell      Automation  'Windows Script Host Object Model'.WshShell
    ReportFilter  Record
    objReport     Report	
    
    // Use Shell Automation Object To SendKeys To Request Form To Auto Preview
    CREATE(WshShell);
    
    // Run Report In Preview Mode, Skipping Request Form
    objReport.SETTABLEVIEW(ReportFilter);
    objReport.RUN;
    WshShell.SendKeys('%{v}'); // Same as Alt+V (Preview)
    CLEAR(WshShell);
    


    Hope that helps.

    Jonathan

    Just as Luc mentioned in the second post. You can google sendkeys to get info on it.
  • krazy89krazy89 Member Posts: 30
    Hey Guys...

    thanks for all the help...

    i ended up using the sendkeys code... and also made 2 copies of the report... one that is printable from the preview screen... and one that isn't printable...

    this option works for my situation... so i'm pretty happy about it...

    once again, THANKS!

    KraZy
    KraZy
Sign In or Register to comment.