dbTalk Databases Forums  

Re: Report print problem...?

comp.databases.paradox comp.databases.paradox


Discuss Re: Report print problem...? in the comp.databases.paradox forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Jim Giner
 
Posts: n/a

Default Re: Report print problem...? - 04-06-2009 , 04:10 PM






On the surface (meaning I didn't debug your query or compare your field
names to that query) it looks pretty straight-forward. You're saying that
the last part (r.print) is the part that fails? Are you sure that the Print
actually fails, and it's not the fault of the r.close failing and causing a
Return? I find that errorshow doesn't alway "show" something - I'd insert a
msgstop in addition so that you always see something if it errors out.

"Kenneth" <usenet (AT) soleSPAMLESSassociates (DOT) com> wrote

Quote:
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."



Reply With Quote
  #2  
Old   
Jim Moseley
 
Posts: n/a

Default Re: Report print problem...? - 04-06-2009 , 05:03 PM







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

Reply With Quote
  #3  
Old   
Jim Giner
 
Posts: n/a

Default Re: Report print problem...? - 04-07-2009 , 09:54 AM



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

Quote:
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."



Reply With Quote
  #4  
Old   
Anders
 
Posts: n/a

Default Re: Report print problem...? - 04-07-2009 , 09:59 AM



Quote:
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."

If I understand correctly that is the table which the report is based on.

You run the report hidden, then print, but you are not closing the report.
That will leave the report on the desktop - hidden - the second time you run
the code the table is "in use" - by the hidden report.

I *think* you need to close the report after the print.

Anders





Reply With Quote
  #5  
Old   
Jim Giner
 
Posts: n/a

Default Re: Report print problem...? - 04-07-2009 , 01:26 PM



YOu do a load command with winstylehidden in it. change that to
winstyledefault and it won't be hidden anymore. That way if your script
crashes, you can easily close the report and try again.
"Kenneth" <usenet (AT) soleSPAMLESSassociates (DOT) com> wrote

Quote:
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."



Reply With Quote
  #6  
Old   
Jim Giner
 
Posts: n/a

Default Re: Report print problem...? - 04-07-2009 , 02:07 PM



I still stand by the suggestions I made for future reference. As do
probably the others who made suggestions.



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.