Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Combining two tables into a query to make a report that displays o

0 views
Skip to first unread message

matt

unread,
Nov 14, 2007, 9:27:02 AM11/14/07
to
I have a database that has a main table and sub-table. I am trying to create
a report that will display the current record and the related info on the
sub-form. I was trying to use a SQL/Query. Any help thanks.

Jeff Boyce

unread,
Nov 14, 2007, 10:04:47 AM11/14/07
to
Matt

Create a new query. Add both tables. Join them on their related field(s).
Add fields from both that you want in the report. Save and close the query.

Create a new report. For a source, point at the query you just created.

--
Regards

Jeff Boyce
www.InformationFutures.net

Microsoft Office/Access MVP
http://mvp.support.microsoft.com/

Microsoft IT Academy Program Mentor
http://microsoftitacademy.com/

"matt" <ma...@discussions.microsoft.com> wrote in message
news:B0D0F42D-C325-42C7...@microsoft.com...

Klatuu

unread,
Nov 14, 2007, 10:11:04 AM11/14/07
to
Access will do that for you.
The Record Source of the main form should be the main table.
The Record Source of the sub form should be the child table.

Sub forms are contained in a subform control. Two properties of the subform
control are Link Master Fields and Link Child Fields. Put the name of the
field in the main table that links to the child time in the Link Master
Fields. Put the name of the field in the child table that links the child to
the master in the Link Child Fields.
--
Dave Hargis, Microsoft Access MVP

matt

unread,
Nov 14, 2007, 10:32:01 AM11/14/07
to
Thanks. I have my Main form set up. Like that but now i am trying to creat a
button on my form that will display a report based on that current record
pulling from both tables.

matt

unread,
Nov 14, 2007, 10:33:02 AM11/14/07
to
Thanks. I have my Main form set up. Like that but now i am trying to creat a
button on my form that will display a report based on that current record
pulling from both tables.

Klatuu

unread,
Nov 14, 2007, 11:19:00 AM11/14/07
to
Create the query from your tables and use it as the record source of the
report.

The use the Where argument of the OpenReport method to specify the record.
It would be the primary key field of the main table.
strWhere = "[ClientID] = " & Me.txtClientID
Docmd.OpenReport "MyReport", , ,strWhere

0 new messages