Reports for individual records

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
 
A

Albert D. Kallal

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top