Error executing code: QueryRun object not initialized.


im getting this error,

Error executing code: QueryRun object not initialized.

(C)\Classes\SK_AR_EINVOICE3\run - line 26
(C)\Classes\SK_AR_EINVOICE3\main - line 9

I have to generate SalesInvoiceReport to a folder. im using ax2009

public static void main(Args args)


if (SK_AR_EINVOICE3.prompt())
{; -->- line 9

public void run()

str strFolderPath;//n=new
str filepath;
str _filename;//n
FileIOPermission dirPermission, filePermission;//n
Set permissionSet;//n
custInvoiceJour custInvoiceJour;
SalesFormLetter salesFormLetter;
PrintJobSettings printJobSettings;
Args args = new Args();
boolean prompt = false;
boolean printIt = true;
str strMainFile;//n
str strFilePath;//n

//date dateFrom, dateTo;
//str 100 printfilename;
select salesParameters;
strMainFile = salesParameters.SKEInvoiceFilePathARV;

while ( → Line 26
gTblCustInvoiceJour = queryrun.get(tableNum(CustInvoiceJour));
InvoiceAccount = gTblCustInvoiceJour.InvoiceAccount;

//gFilePath = strFmt(@"%1%2-%3",strMainFile, year(dToDate), mthOfYr(dToDate))+ strFmt(@"%1",strCostCenter) + strFmt(@"%1",gCustTable.AccountNum) ;
gFilePath = strFmt(@"%1",strMainFile) + strFmt(@"%1",gTblCustInvoiceJour.InvoiceAccount) ;

info(strFmt("%1", gFilePath));




}}//close class


Not sure where you are using the report? How your are building the query and initializing queryRun?

i have to create a menu item,then display a dialog,then generate the sales invoice report based on selected info on the dialog by user. how to build the quey and initializing the new to ax

Is that a custom report? Why do you need a class for that and why cannot you just open the report directly?

See this documentation for report basics,…/cc967382(v=ax.50).aspx

yes custom report.i have to send the pdf report via first step, i have to generate pdf report into a folder, then email the pdf file.

It doesn’t answer why you’ve created a class instead of simply setting the print destination to PDF or e-mail.

If you want to keep your class, look at where you’re initializing queryRun. Either you forgot it completely or you have a bug there.