one of the client workstations was attempting to print to a network printer. The Sesame server engine on the server stopped completely, and Microsoft Windows displayed its "this program has stopped unexpectedly; press 'send report' to notify Microsoft of this problem, blah blah blah". When these crashes happen (and it isn't specific to just one workstation), it is 'often' when someone is printing something.
One of the first things my Print command button code does is to use CreateAProcess to 'set' the printer to use for that print routine (some buttons 'set' the color printer for sales orders; some 'set' the Label printer for delivery or inventory labels, etc). I have an 'internal housekeeping Client record' that we use to designate some universal things like printers (previous solution was: for example, our network 'sales order printer' is named wcOrderL on all of our workstations. But if that printer has a temporary problem and we can't print to it, then to print orders I have to either 1) go into Sesame Designer and name another printer in the code, then get everyone out of Sesame, then reconcile - and then reverse that process when the wcOrderL printer become functional again; or 2) go into every workstation and rename a different printer (the wcInvoic printer, for example) to be 'wcOrderL' so that Sesame code will print to the correct printer. A big, cumbersome pain - and a real problem if I'm physically not in the office (my staff is many things, but technically savvy/adept is not among those many attributes). The benefit of the solution I came up with is that now, if we want to redirect a certain print function to a different printer, we just pull up client record 1000, and change the name of the printer in the OrderPrinter field, then save the client record, and all print routines will now read this newly inserted printer name and use it to print orders. No fuss, no muss.
Here is the print code - am I doing something idiotic that is just not reasonable? Should I have a longer Loiter for the 'workstation wishing to print' to allow more time to make the 'default printer designation' ? Should I add code that 'checks to see if vPrinterOrders is not "" before allowing the rest of the code to run?
vPrint = 0 vRS1 = @XResultSetSearch(@FN, "Client", SEARCH_MODE_AND, SEARCH_SYNTAX_QA, "!ClientID=" + "1000") If vRS1 > -1 { If @XResultSetLocked(vRS1) = 1 { vPrint = 1 } else If @XResultSetLocked(vRS1) = 0 { If @XresultSetTotal(vRS1) = 1 // if there is exactly one matching record in Client, and it's #1000 { vPrint = 0 vPrinterLabels = @XResultSetValue(vRS1, "PrinterLabels") vPrinterInternal = @XResultSetValue(vRS1, "PrinterInternal") vPrinterOrders = @XResultSetValue(vRS1, "PrinterOrders") vPrinterInvoices = @XResultSetValue(vRS1, "PrinterInvoices") } } } XResultSetClose(vRS1)
If vPrint = 1 { @MsgBox("Printer definition table is locked.","Please try again in a second.","") } else if vPrint = 0
{ // this "{" allows the remainder of code to run
CreateAProcess("RUNDLL32 PRINTUI.DLL,PrintUIEntry /y /n " + vPrinterOrders) Loiter(1000)
|