One way to do this is by setting up a report based on a query that looks at
the form's current record and returns only that record for your report. If
you have an autonumber field in your primary table, then this gets easier,
because you can use that autonumber field as the search field in the report.
If you don't have this type of field, don't worry. It will still work if
you use the primary key field (No duplicates).
For this report, you only need to create the query for the primary table.
You can use Subreports for the child tables. This will ensure that you only
get the records for the corresponding primary table record.
This can be created as follows:
1. Open the Query editor and give it a name. Preferably "QryCurrRecord" or
something to that effect
2. Add all the fields you want in the report including the primary key.
3. In the Primary Key "Criteria" field, enter the form and field name as
follows:
=Forms!<FormName>!<fieldName>
NOTE: The form and field name most be preceeded by =Forms! or else it won't
work.
When the report opens, the query will look at the value in the primary key
field of the form and search the database's primary table for a match. When
it finds it, the report opens and the date selected for inclusion in the
report will be displayed. The subreports will then use the primary key of
the main table to populate the corresponding information in their fields.
Bob
John <jo****@hotmail.hr> wrote in message
news:bu**********@ls219.htnet.hr...
Hi,
I have simple database based on 3 tables. Relationship is 'one to many'
between table 1 and 2, also between 2 and 3 table'one to many'.
I have made form where I enter data in all 3 tables. Form has 2 subform
based on relationships.
I want to make report to print data which is shown on form. I want to
print only data from form, not whole records from tables. Does anyone knows how
to do this? I have tried with report based on query, but I get error message.
I was trying to put criteria in query like [Forms]![Name of form]![Name of
field], but doesn't work.
Thanks in advance.