Print Button Does Not Work Properly

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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?
 
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.
 
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.
 
Back
Top