Solved

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

Posted on 2011-03-24
3
346 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 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 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
find first method with 2 variable search criteria 10 48
Compress Newid value ms sql Mssql 4 47
GA Ribbon creator 9 63
SUBFORM on ACCESS 2013 8 35
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
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…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

739 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