![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
|
Howdy, Running P9 with XP I have a button with several blocks of code on it. Usually, all works well. The portion below runs a query, loads a report, and prints the report. Sometimes however, the report fails to print. It generates no errors, and if it fails to print, and I then view the report manually, it looks fine, and manually prints properly. I have had problems with code to print reports in the past, and for many of them, have gone to Microsoft Word for the actual printing. I could do that for this purpose, but before I do, thought to ask: Might you see a problem with the code below? qInv = Query ANSWER: :MONEY:INVOICE.DB :MONEY:INVOICES.DB | Num | InvNumber | Replaces | Last | First | | Check _join1 | Check ~newInvNumber | Check | Check as LastNameField | Check | :MONEY:INVOICES.DB | Adr | Purpose | InvDate | DueDate | DUE | RECEIVED | | Check | Check | Check | Check | Check | Check | :MONEY:INVOICES.DB | Balance | Tag | Comment | ReplaceNote | | Check | Check | Check | Check | ADDRESS.DB | Num | L7 | L6 | L5 | L4 | L3 | L2 | | _join1 | Check | Check | Check | Check | Check | Check | ADDRESS.DB | L1 | City | State | Zip | Inv | | Check | Check | Check | Check | True | EndQuery if not executeQBE(qInv) then errorShow() return endIf if not r.load(":MONEY:Invoice",winStyleHidden) then errorShow() return endIf r.pastDueText.visible=FALSE r.pastDueBox.visible=FALSE r.balanceLabel.visible=FALSE r.balance.FONT.COLOR=WHITE r.receivedLabel.visible=FALSE r.received.FONT.COLOR=WHITE r.matures.visible=true r.line.visible=false r.save() if not r.close() then errorShow() return endIf if not r.print(":MONEY:Invoice") then errorShow() return endIf Sincere thanks, -- Kenneth If you email... Please remove the "SPAMLESS." |
#2
| |||
| |||
|
#3
| |||
| |||
|
|
On 6 Apr 2009 17:03:39 -0400, "Jim Moseley" jmose (AT) mapson (DOT) triptracker.com> wrote: Kenneth, You need to test the result of the Save(). But, really, why are you saving the report? Since you used Load(), you can adjust it however you want, then directly Run() it. Also, if this is a multi-user application, you might be overwriting each other's report. Here's my suggested fix: ;r.save() ; <- do not need ;if not r.close() then; ; <- do not need ; errorShow() ; <- do not need ;return ; <- do not need ;endIf ; <- do not need if not r.run() then ; <- add errorShow() ; <- add return ; <- add endif ; <- add if not r.print(":MONEY:Invoice") then errorShow() return endIf HTH, Jim Moseley Hi Jim, I'm making progress (of a sort), but the report still won't print. Here's the current code: qInv = Query ANSWER: :MONEY:INVOICE.DB :MONEY:INVOICES.DB | Num | InvNumber | Replaces | Last | First | | Check _join1 | Check ~newInvNumber | Check | Check as LastNameField | Check | :MONEY:INVOICES.DB | Adr | Purpose | InvDate | DueDate | DUE | RECEIVED | | Check | Check | Check | Check | Check | Check | :MONEY:INVOICES.DB | Balance | Tag | Comment | ReplaceNote | | Check | Check | Check | Check | ADDRESS.DB | Num | L7 | L6 | L5 | L4 | L3 | L2 | | _join1 | Check | Check | Check | Check | Check | Check | ADDRESS.DB | L1 | City | State | Zip | Inv | | Check | Check | Check | Check | True | EndQuery if not executeQBE(qInv) then errorShow() return endIf if not r.load(":MONEY:Invoice",winStyleHidden) then errorShow() sleep(2000) return endIf r.pastDueText.visible=FALSE r.pastDueBox.visible=FALSE r.balanceLabel.visible=FALSE r.balance.FONT.COLOR=WHITE r.receivedLabel.visible=FALSE r.received.FONT.COLOR=WHITE r.matures.visible=true r.line.visible=false if not r.run() then errorShow() return endIf if not r.print(":MONEY:Invoice") then errorShow() return endIf When I run the code, I get an error on the query telling me that it can't run because its destination table, :MONEY:INVOICE.DB, is "in use." Nothhing anywhere else points to that table, so I am having trouble understand how it could be "in use." (And, when I try to open it manually, it opens properly, and appears empty.) What might be an appropriate next step in sorting this out? Many thanks, as before, -- Kenneth If you email... Please remove the "SPAMLESS." |
#4
| |||
| |||
|
|
When I run the code, I get an error on the query telling me that it can't run because its destination table, :MONEY:INVOICE.DB, is "in use." |
#5
| |||
| |||
|
|
On Tue, 7 Apr 2009 09:54:51 -0400, "Jim Giner" jim.giner (AT) suny (DOT) edu> wrote: During your trial and error(s), you probably have a "hidden" report on your desktop. Remove the hide parm of the load and debug your script - that way you'll know if you have something still open on that table. "Kenneth" <usenet (AT) soleSPAMLESSassociates (DOT) com> wrote in message news:gjkmt4tapc4qkaq35ht3mt05rgpmqbqins (AT) 4ax (DOT) com... On 6 Apr 2009 17:03:39 -0400, "Jim Moseley" jmose (AT) mapson (DOT) triptracker.com> wrote: Hi Jim, You comment makes sense to me, but I don't know just what I should be searching for (to remove its hidden attribute.) Thanks again, -- Kenneth If you email... Please remove the "SPAMLESS." |
#6
| |||
| |||
|
![]() |
| Thread Tools | |
| Display Modes | |
| |