Solved

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

Posted on 2011-03-24
3
347 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
[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 48

Accepted Solution

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

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

0
 
LVL 120

Assisted Solution

by:Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1) 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
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…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

628 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