Link to home
Start Free TrialLog in
Avatar of thewesties
thewesties

asked on

Create a report from current record in form

  I have a form (frmProposal) which gets its data from a query that combines two tables (tblCustomers and tblBidDescription).  There is a report (rptProposal) that uses  the data from another query (qryProposal) to generate (surprise!!) a proposal.  I am looking to open the rptProposal from the frmProposal using the [ProposalNumber] on the frmProposal.  I have tried using an EventProcedure in the OnClick property of the Command Button that opens rptProposal:

Private Sub PreviewProposal_Click()

On Error GoTo Err_PreviewProposal_Click

    Dim stDocName As String
    stDocName = "rptProposal"

    DoCmd.OpenReport stDocName, acPreview, "[ProposalNumber]=" = Me![ProposalNumber]

Exit_PreviewProposal_Click:
    Exit Sub

Err_PreviewProposal_Click:
    MsgBox Err.Description
    Resume Exit_PreviewProposal_Click

End Sub

However, this still opens ALL proposals.  How can I just get it to open the Report using ONLY the Proposal based off of the record I am working on and not every record in the database.
ASKER CERTIFIED SOLUTION
Avatar of frankytee
frankytee
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Mach1pro
Mach1pro

Try this:

DoCmd.OpenReport stDocName, acPreview, "[ProposalNumber]=" &  Me![ProposalNumber]
Avatar of thewesties

ASKER

Thank you.  I was batting my head against a wall.  Thought I tried that.  Must have been a brain fart!!  Regards, Westy