Hi, I have a report that I want to run with vba. It is a receipt.
Here is the code:
DoCmd.OpenReport "rpt_Down_Payment_Receipt", acViewPreview, , "DNLID = " & DNLID
The issue is the data for the report is based on a one to many relationship.
So Main Record PK DNLID, subform PK RECID, FK DNLID
The main form is linked to the subform with DNLID
DNLID is the PK but the sub form has a unique PK for each record. So say I am on receipt #2 and want to print that. What is happening now with the above code it always opens the first ID (pk in receipts table)
Is there a way to change or add the code so the report opens with the actual receipt data I want to print?
Thanks.
Fen
Here is the code:
DoCmd.OpenReport "rpt_Down_Payment_Receipt", acViewPreview, , "DNLID = " & DNLID
The issue is the data for the report is based on a one to many relationship.
So Main Record PK DNLID, subform PK RECID, FK DNLID
The main form is linked to the subform with DNLID
DNLID is the PK but the sub form has a unique PK for each record. So say I am on receipt #2 and want to print that. What is happening now with the above code it always opens the first ID (pk in receipts table)
Is there a way to change or add the code so the report opens with the actual receipt data I want to print?
Thanks.
Fen