Solved

Create a report from current record in form

Posted on 2001-06-06
3
210 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 19

Accepted Solution

by:
frankytee earned 100 total points
ID: 6162127
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
ID: 6162130
Try this:

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

Author Comment

by:thewesties
ID: 6162313
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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

726 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