Reports for individual records

  • Thread starter Thread starter JB
  • Start date Start date
J

JB

Hi.
I'm getting in a muddle.
I'm trying to create a report but run it from a form to only show the
details of that form.
i.e.
The Tables are:
Customers
Suppliers
Agent
Products
Orders
Order details


In the Orders & Orders Details subform Form I'm on a record say Mr Joe Blogs
(customer) and I want to Print out the order form but only of that
particular order for that particular customer.
I create the open form command but it is pages and pages of every order in
the table.
Please help. Thanks
 
The code behind your button will look like:


docmd.OpenReport "name of report",acViewPreview,,"id = " & me!id

The above assumes your "main" table (main form) has a primary key called
"id".

Also, if you allow editing of the form, then you need to force the main
record to disk (because the report takes the data from the tables, not the
form).

So, the aobve code should be:

if me.dirty = true then
me.dirty = false
end if

docmd.OpenReport "name of report",acViewPreview,,"id = " & me!id
 
Back
Top