I have two tables and a report, tbl1
, tbl2
and rptAllOrders
.
tbl1
and tbl2
are not identical.
The report is not bound to any recordsource and so is it's the controls.
Is this doable in VBA? Or is there a better alternative way?
Private Sub btnReport_Click()
DoCmd.OpenReport "rptAllOders" , , acViewPriview
End Sub
Private Sub rptAllOders_Open(Cancel As integer)
Dim strq As string
strq = "SELECT tbl1.ItemNo, tbl1.ItemName,
tbl2.OderDate, tbl2.OderNo FROM tbl1 UNION ALL ON
tbl1.ItemNo = tbl2.ItemNo AND ItemName =
'"Forms!comboItemName.Value"' ORDER BY oderDate
ASC"
End Sub