• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 358
  • Last Modified:

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

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
Patrick O'Dea
Asked:
Patrick O'Dea
2 Solutions
 
Dale FyeCommented:
If [CustomerID] is numeric, then it should look like:

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

0
 
Rey Obrero (Capricorn1)Commented:
try without the ";"

sWhere = "[CustomerID] ='" & CustomerID & "'"
0
 
Patrick O'DeaAuthor Commented:
Thanks All,
 got it now !
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now