Solved

Create a report from current record in form

Posted on 2001-06-06
3
198 Views
Last Modified: 2012-06-27
  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.
0
Comment
Question by:thewesties
3 Comments
 
LVL 19

Accepted Solution

by:
frankytee earned 100 total points
Comment Utility
you are almost there!
you put the filter in the wrong argument (it should be in the WHERE argument and not the filtername)

just add an extra comma and alter the your filter with the ampersand (&), ie
DoCmd.OpenReport stDocName, acPreview, ,"[ProposalNumber]=" & Me![ProposalNumber]

0
 
LVL 6

Expert Comment

by:Mach1pro
Comment Utility
Try this:

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

Author Comment

by:thewesties
Comment Utility
Thank you.  I was batting my head against a wall.  Thought I tried that.  Must have been a brain fart!!  Regards, Westy
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now