Open a Report with two different forms

E

Eric

I have a report (rptRepairRequest) that I have command button that
prints it out from a form based on the ID of that form. This works
fine. What I would like, and not sure if it is possible, is to have
another form where I can just select the ID from a drop-down and open
the same report.

My record source for the report is currently:
SELECT tblRepairList.* FROM tblRepairList WHERE
(((tblRepairList.RepairID)=Forms!frmSerReqEntry!txtRepairID));

I tried adding an OR statement at the end:
"OR (tblRepairList.RepairID)=Forms![frmRptRepairRequest]!
[cboRepairID]"
but it asks me for 'Forms!frmSerReqEntry!txtRepairID'

Are is there anyway to make this work, without making a new report?
 
M

Marshall Barton

Eric said:
I have a report (rptRepairRequest) that I have command button that
prints it out from a form based on the ID of that form. This works
fine. What I would like, and not sure if it is possible, is to have
another form where I can just select the ID from a drop-down and open
the same report.

My record source for the report is currently:
SELECT tblRepairList.* FROM tblRepairList WHERE
(((tblRepairList.RepairID)=Forms!frmSerReqEntry!txtRepairID));

I tried adding an OR statement at the end:
"OR (tblRepairList.RepairID)=Forms![frmRptRepairRequest]!
[cboRepairID]"
but it asks me for 'Forms!frmSerReqEntry!txtRepairID'

Are is there anyway to make this work, without making a new report?


Remove the criteria from the query.

Instead use the button code to use the OpenReport's
WhereCondition argument:

DoCmd.OpenReport "report name", _
WhereCondition:= "RepairID=" & Me!txtRepairID
 
E

Eric

Eric said:
I have a report (rptRepairRequest) that I have command button that
prints it out from a form based on the ID of that form. This works
fine. What I would like, and not sure if it is possible, is to have
another form where I can just select the ID from a drop-down and open
the same report.
My record source for the report is currently:
SELECT tblRepairList.* FROM tblRepairList WHERE
(((tblRepairList.RepairID)=Forms!frmSerReqEntry!txtRepairID));
I tried adding an OR statement at the end:
"OR (tblRepairList.RepairID)=Forms![frmRptRepairRequest]!
[cboRepairID]"
but it asks me for 'Forms!frmSerReqEntry!txtRepairID'
Are is there anyway to make this work, without making a new report?

Remove the criteria from the query.

Instead use the button code to use the OpenReport's
WhereCondition argument:

DoCmd.OpenReport "report name", _
WhereCondition:= "RepairID=" & Me!txtRepairID

Oh fantastic! That worked exactly like I wanted it. Thank you!
 

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