I keep having a nagging, intermittent problem with Sesame crashing while we're receiving in product and printing inventory labels for those items. So, as we're receiving in line items on the POLines subform, the focus goes to QtyRecd field. We enter the quantity incoming, then tab which takes the focus to the PrintInventoryLabels command button. We click on that button, and it executes the following code to print the labels to a Brother QL-580 network label printer: vLoop = 1 NewDocument(1) While vLoop <= vQtyRecd0 { NewPage(840, 240) PrintPageOrientation(2) PrintString(vItemNum, 6, 6, 0, " ARIAL", 11, 0) PrintString(vItemDesc, 6, @PageExtentY(), 200, " ARIAL", 8, 0) PrintString("---------------", 160, 48, 0, " ARIAL", 9, 0) PrintString("WordCom 918-582-8844", 15, 54, 0, " ARIAL", 9, 0) PrintString("PO#" + " " + vPONum, 160, 54, 0, " ARIAL", 9, 0) PrintString("www.wordcom.com" + " [ " + vAvgSalesPerWeek + " ]", 15, 63, 0, " Arial", 8, 0) FinishPage() //Loiter(200) vLoop = vLoop + 1 } FinishDocument()
Loiter(500)
//RestoreDefaultPrinter() ThrowFocus(NextRecord)My belief is that what causes the crash (which I have been unable to ascertain a pattern to it) is if we go through the receive routine too quickly, and the print buffer gets bogged down (in other words, if we receive 30 each of ItemA and print labels, then immediately receive in 20 each of ItemB and click PrintLabelsButton - while Sesame is still printing the labels from ItemA (due to the relatively slower speed of the label printer) - then sometimes the program will crash, and I'm wondering if the print buffer is getting overwhelmed, or if Sesame is running up on itself ? Is there a more efficient/effective way for me to structure this printing code piece?
|