Solved

Access : Print ONE record in a report (i.e. record in Form)

Posted on 2011-03-24
3
342 Views
Last Modified: 2012-05-11
Hi,

I have a form with a button.  I have an existing report.

When the form button is clicked I want to print a single A4 page that relates exclusively to the customer on the Form.  The field CustomerID is on both the Form and the Report.

I am struggling with the "WHERE" clause.  See cust and paste below.
I want one record on the report
...where the CustomerID on the form = the Customer ID on the report


(I raised this query earlier today in a more confusing manner!)a




Private Sub rptOrderConfirmation_Click()

   Dim sWhere As String
  
   '******  sWhere = "[CustomerID] ='" & CustomerID & "';"
      DoCmd.OpenReport "rptOrderDetails", acViewPreview, , sWhere
   DoCmd.Maximize


End Sub

Open in new window

0
Comment
Question by:Patrick O'Dea
3 Comments
 
LVL 47

Accepted Solution

by:
Dale Fye (Access MVP) earned 250 total points
ID: 35207795
If [CustomerID] is numeric, then it should look like:

sWhere = "[CustomerID] = " & me.CustomerID

0
 
LVL 119

Assisted Solution

by:Rey Obrero
Rey Obrero earned 250 total points
ID: 35207918
try without the ";"

sWhere = "[CustomerID] ='" & CustomerID & "'"
0
 

Author Closing Comment

by:Patrick O'Dea
ID: 35209572
Thanks All,
 got it now !
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)

Join & Write a Comment

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
Today's users almost expect this to happen in all search boxes. After all, if their favourite search engine juggles with tens of thousand keywords while they type, and suggests matching phrases on the fly, why shouldn't they expect the same from you…
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.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

746 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

12 Experts available now in Live!

Get 1:1 Help Now