Printusingform and printonerecord bug?

I am working on a simple procedure to print packing lists.
The procedure builds an array of items not printed, it is vSlipNumbersNotPrinted and has 1 value delimited with cr(). It looks like this.

1603
1604
1605

The array is processed with this loop

loop
stoploopif vCounter > vArraySize
vSearchValue=Array(vSlipNumbersNotPrinted,vCounter,cr())
select DeliverySlipNumber = val(vSearchValue)
if info(“empty”)
message “There was a problem”
rtn
endif
printusingform “”, “DeliverySlipPrint”
printonerecord dialog
vCounter=vCounter+1
endloop

The vCounter variable is not incremented when it is after the printonerecord dialog line. It does work if it is put before it like this.

vCounter=vCounter+1
printusingform “”, “DeliverySlipPrint”
printonerecord dialog

Bug?

There definitely seems to be a problem with printonerecord. With this code:

openform "Invoice"
printonerecord ""
openform "Invoice"
closewindow

… the Invoice form doesn’t open. In fact, no statement after the printonerecord is executed.

This is now an old bug - is there a work-around?

That’s possibly a bit confusing, with the two openform "Invoice" statements.

What’s happening is that I have another form in the same database open - it invokes the code which formats and prints the invoice form. When the printonerecord statement executes, the original calling form comes to the front and is overlaid by the print dialog box. When the Print button is clicked, the original form is still displayed. I want to get back to the (Invoice* form and close it.

Hi Michael,

Try this.

printusingform “”,“YourForm”
printonerecord dialog (Or Not)

printusingform does nothing but it doesn’t stop the procedure.

The other odd thing is that printonerecord "" brings up the print dialog even tho it’s not supposed to. Panorama X just doesn’t work properly for me and I have no idea why.

This is a documented change in Panorama X.

I suggest that you use the printtopdf statement.

printtopdf "","Printer","","Form","Invoice","OneRecord","true"

The only thing to keep in mind is that you must use this from a form – it won’t work from the data sheet.

Yep - works like a charm. Thank you.