Print a RB report from a vb form

Thanks Babette and also Calvin who emailed.
Problem solved.

Regards

Richard Whalebelly
IT Manager

SHelbourne Reynolds Eng Ltd


--- In vantage@yahoogroups.com, "Babette Welch" <bwelch@...> wrote:
>
> Michael Podlin assisted us in doing this last year.
>
> At the Command line for the VBForm button put:
> RUNPROG label_jobWASP.p
>
> Save the p version at
> V:\mfgsys61\VBP
> (not compiled)
>
> Here is the code, replace your library and report names:
> --------------------------------------------------
>
> {VBP\VB.I}
> /* This is required by Epicor Vantage. */
> /* program written 2/25/05 by Babette Welch, assisrance & template
from Michael Podlin */
> /* associated with button in Job Tracker>VBForm, button code is
RUNPROG VBP\job_label.p */
> /* No compile, text file only */
>
> DEF VAR ReportLibrary AS CHARACTER INITIAL "V:\mfgsys61
\ud\argo_rpts\Menu.prl". /* This is the Report Builder Library file
and full path */
> DEF VAR ReportName AS CHARACTER INITIAL "label_jobWASP". /* This
is the name of the report you want to run */
> DEF VAR ReportFilter AS CHARACTER INITIAL "". /* This is the
filters to use with the report you want to run */
> DEF VAR ReportMethod AS CHARACTER INITIAL "".
> /* This defines how to handle the report. Entering a "P" will
cause the report to run to the workstations default printer. */
> /* Entering a "D" will call up the report in a preview mode first
on the screen. */
> /* Leaving it blank will cause the following screen to appear on
the workstation and the user can then select the method of running
the report. */
> /* The name of the report will appear in the window title bar and
all available printers will in the the drop down selection list. */
> /* The workstations default printer will be the default choice.*/
>
> DEF VAR ReportCopies AS INTEGER INITIAL 1. /* This allows you to
select the number of copies to print. Default is one. */
> DEF VAR ReportMessage AS CHARACTER INITIAL "". /* ReportMessage is
used to relay a message to the user. */
> /* Some reports take a long time to run and it may be useful to
notify the user of this and give the user the chance */
> /* to cancel out of running the report. The popup message will
look like the one below. */
> /* It will display the report name and the message you assign to
the ReportMessage variable. */
> /* The "Do you wish to continue?" is automatically added as the
last line of text. Leaving the ReportMessage variable blank will
bypass this message. */
>
> FIND jobhead WHERE ROWID(jobhead) = GetCurrentRowID() no-lock. /*
Replace "DatabaseTable" with the table name */
> /* that is associated with the VBForm that you will be launching
this from. */
>
> ASSIGN ReportFilter = "Jobhead.JobNum='" + jobhead.jobnum + "'"
+ "and substring(jobasmbl.partnum,1,5)<>'ester' and substring
(jobasmbl.partnum,1,5)<>'ether' and substring(jobasmbl.partnum,1,3)
<>'ar-'".
> /* You will need to enclose character values in single quote
marks. Numeric values will have to be defined using a STRING
(Table.Integervaluefield). */
>
> RUN VBP\VBFormRpt.R(ReportLibrary, ReportName, ReportFilter,
ReportMethod, ReportCopies, ReportMessage).
>
> --------------------------------------------------
> Babette Welch
> IT Director
> Argonics, Inc.
> 1110 Wright Street
> Marquette MI 49855
> 906.226.9747 ext 235
>
>
>
>
> [Non-text portions of this message have been removed]
>
Hi all

This is the first time I have been using vb forms. I want to print a
report builder report form the part tracker vb form. Looking at past
messages I found that creating a .p file and running it from a
button was the way to go. However I cannot get it to work.

All I keep getting is the error PartsSold not found.

This is the .p program I am using. I have compiled this file to
create a .r file.

DEF var report-library AS CHARACTER init "".
DEF VAR RB-REPORT-NAME AS CHARACTER INITIAL "".
DEF VAR RB-DB-CONNECTION AS CHARACTER INITIAL "".
DEF VAR RB-INCLUDE-RECORDS AS CHARACTER INITIAL "?".
DEF VAR RB-FILTER AS CHARACTER INITIAL "".
DEF VAR RB-MEMO-FILE AS CHARACTER INITIAL "".
DEF VAR RB-PRINT-DESTINATION AS CHARACTER INITIAL "?".
DEF VAR RB-PRINTER-NAME AS CHARACTER INITIAL "?".
DEF VAR RB-PRINTER-PORT AS CHARACTER INITIAL "".
DEF VAR RB-OUTPUT-FILE AS CHARACTER INITIAL "".
DEF VAR RB-NUMBER-COPIES AS INTEGER INITIAL 1.
DEF VAR RB-BEGIN-PAGE AS INTEGER INITIAL 0.
DEF VAR RB-END-PAGE AS INTEGER INITIAL 0.
DEF VAR RB-TEST-PATTERN AS LOGICAL INITIAL no.
DEF VAR RB-WINDOW-TITLE AS CHARACTER INITIAL "".
DEF VAR RB-DISPLAY-ERRORS AS LOGICAL INITIAL yes.
DEF VAR RB-DISPLAY-STATUS AS LOGICAL INITIAL yes.
DEF VAR RB-NO-WAIT AS LOGICAL INITIAL no.
DEF VAR RB-OTHER-PARAMETERS AS CHARACTER INITIAL "".

RB-Report-name = "Total Parts Shipped".
report-library = "v6prod.prl".
RB-Print-destination = "?".
RB-filter = "?".

RUN aderb/_printrb.p (report-library,
RB-REPORT-NAME,
RB-DB-CONNECTION,
RB-INCLUDE-RECORDS,
RB-FILTER,
RB-MEMO-FILE,
RB-PRINT-DESTINATION,
RB-PRINTER-NAME,
RB-PRINTER-PORT,
RB-OUTPUT-FILE,
RB-NUMBER-COPIES,
RB-BEGIN-PAGE,
RB-END-PAGE,
RB-TEST-PATTERN,
RB-WINDOW-TITLE,
RB-DISPLAY-ERRORS,
RB-DISPLAY-STATUS,
RB-NO-WAIT,
RB-OTHER-PARAMETERS).

Any help will be appreciated.

Regards

Richard Whalebelly
Shelbourne Reynolds Eng Ltd
Michael Podlin assisted us in doing this last year.

At the Command line for the VBForm button put:
RUNPROG label_jobWASP.p

Save the p version at
V:\mfgsys61\VBP
(not compiled)

Here is the code, replace your library and report names:
--------------------------------------------------

{VBP\VB.I}
/* This is required by Epicor Vantage. */
/* program written 2/25/05 by Babette Welch, assisrance & template from Michael Podlin */
/* associated with button in Job Tracker>VBForm, button code is RUNPROG VBP\job_label.p */
/* No compile, text file only */

DEF VAR ReportLibrary AS CHARACTER INITIAL "V:\mfgsys61\ud\argo_rpts\Menu.prl". /* This is the Report Builder Library file and full path */
DEF VAR ReportName AS CHARACTER INITIAL "label_jobWASP". /* This is the name of the report you want to run */
DEF VAR ReportFilter AS CHARACTER INITIAL "". /* This is the filters to use with the report you want to run */
DEF VAR ReportMethod AS CHARACTER INITIAL "".
/* This defines how to handle the report. Entering a "P" will cause the report to run to the workstations default printer. */
/* Entering a "D" will call up the report in a preview mode first on the screen. */
/* Leaving it blank will cause the following screen to appear on the workstation and the user can then select the method of running the report. */
/* The name of the report will appear in the window title bar and all available printers will in the the drop down selection list. */
/* The workstations default printer will be the default choice.*/

DEF VAR ReportCopies AS INTEGER INITIAL 1. /* This allows you to select the number of copies to print. Default is one. */
DEF VAR ReportMessage AS CHARACTER INITIAL "". /* ReportMessage is used to relay a message to the user. */
/* Some reports take a long time to run and it may be useful to notify the user of this and give the user the chance */
/* to cancel out of running the report. The popup message will look like the one below. */
/* It will display the report name and the message you assign to the ReportMessage variable. */
/* The "Do you wish to continue?" is automatically added as the last line of text. Leaving the ReportMessage variable blank will bypass this message. */

FIND jobhead WHERE ROWID(jobhead) = GetCurrentRowID() no-lock. /* Replace "DatabaseTable" with the table name */
/* that is associated with the VBForm that you will be launching this from. */

ASSIGN ReportFilter = "Jobhead.JobNum='" + jobhead.jobnum + "'" + "and substring(jobasmbl.partnum,1,5)<>'ester' and substring(jobasmbl.partnum,1,5)<>'ether' and substring(jobasmbl.partnum,1,3)<>'ar-'".
/* You will need to enclose character values in single quote marks. Numeric values will have to be defined using a STRING(Table.Integervaluefield). */

RUN VBP\VBFormRpt.R(ReportLibrary, ReportName, ReportFilter, ReportMethod, ReportCopies, ReportMessage).

--------------------------------------------------
Babette Welch
IT Director
Argonics, Inc.
1110 Wright Street
Marquette MI 49855
906.226.9747 ext 235




[Non-text portions of this message have been removed]