Application

  • Thread starter Thread starter Jaime
  • Start date Start date
Jaime,

You will need to add a Where Condition to the OpenReport method so that the
report shows only the information for the record displayed on your form.
For example, if the current record on your form was for a particular
customer, you could use the CustID field to determine the where condition as
follows:

Dim strCriteria As String

' This works when your matching field is text
strCriteria = "[CustID] = " & Chr(34) & Me!CustID & Chr(34)
DoCmd.OpenReport "MyReport", acViewNormal, , strCriteria

' This works when your matching field is a number
strCriteria = "[CustID] = " & Me!CustID
DoCmd.OpenReport "MyReport", acViewNormal, , strCriteria

hth,
 
-----Original Message-----
How can I print or display a report of a single record
displayed on a form
.

Open up your form (i.e. Load it). Now minimise it so you
can do other things...Now you can create a Query taking in
all the fields from the same Data that the form accesses.
In the field/column that determines your individual field,
right-click the 'criteria' cell and click Build.

This pops up the Expression Builder

Now click on Forms:Loaded Forms:

Select your Open Form
Select the data that is key and double click it.

You should get something like
[Forms]![ESTIMATE MAIN]![Site Visit Form Information].
[Form]![Unique Form ID]

This form finds the value of Unique Form ID which sits on
the form "Site Visit Information". Site Visit Information
happens to be a sub-form of ESTIMATE MAIN.

Now link your Report to your query and place a
Print/Preview Form button on your form.

So, the query only shows that unique form that is open at
that time of clicking your button

Hope that helps
 
Back
Top