Print Button Does Not Work Properly

T

Ty Archer

Hi,
I have a purchase order database, with two tables that are linked via PONum
field. On my form I have a print button that prints the current record on
screen, with the following Event Code.

stDocName = "Rpt-POs"
DoCmd.OpenReport stDocName, acPreview, , "[PONum]='" & Me![PONum] & "'"

My problem is that it prints ok if there are records in the sub table,
however, if there is no records in the subtable, the main record does not
print. I get "Error messages. Can anyone help?
 
R

Rick Brandt

Ty said:
Hi,
I have a purchase order database, with two tables that are linked via
PONum field. On my form I have a print button that prints the current
record on screen, with the following Event Code.

stDocName = "Rpt-POs"
DoCmd.OpenReport stDocName, acPreview, , "[PONum]='" & Me![PONum] &
"'"

My problem is that it prints ok if there are records in the sub table,
however, if there is no records in the subtable, the main record does
not print. I get "Error messages. Can anyone help?

You need to change the join used in the query from an INNER join to an OUTER
join. If you double-click the existing join line the dialog that pops up is
pretty self-explanatory.
 
T

Ty Archer

Thanks very much. It works great!

Rick Brandt said:
Ty said:
Hi,
I have a purchase order database, with two tables that are linked via
PONum field. On my form I have a print button that prints the current
record on screen, with the following Event Code.

stDocName = "Rpt-POs"
DoCmd.OpenReport stDocName, acPreview, , "[PONum]='" & Me![PONum] &
"'"

My problem is that it prints ok if there are records in the sub table,
however, if there is no records in the subtable, the main record does
not print. I get "Error messages. Can anyone help?

You need to change the join used in the query from an INNER join to an OUTER
join. If you double-click the existing join line the dialog that pops up is
pretty self-explanatory.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top