incorrect report from parent/child subform.

A

Arjan

All,

On page 1 of a tabcontrol there are project data fields (table project), on
the second page there is subform with project related documents (table
documents). This subform has a parent/childlink (projectID) which is in the
project table and in the documents table.
On the 3rd tabpage I have some buttons for reports. I use the below code to
preview the report. which should only give the related documents form the
project.
However it give the correct project data but not the related documents...

Private Sub Command134_Click()
'generate print preview.
DoCmd.OpenQuery "QueryDWG", , acReadOnly
DoCmd.OpenReport "Drawings", acViewPreview, , "ProjectID = " & Me.ProjectID
End Sub

What i'm I doing wrong?
 
J

John W. Vinson

All,

On page 1 of a tabcontrol there are project data fields (table project), on
the second page there is subform with project related documents (table
documents). This subform has a parent/childlink (projectID) which is in the
project table and in the documents table.
On the 3rd tabpage I have some buttons for reports. I use the below code to
preview the report. which should only give the related documents form the
project.
However it give the correct project data but not the related documents...

Private Sub Command134_Click()
'generate print preview.
DoCmd.OpenQuery "QueryDWG", , acReadOnly
DoCmd.OpenReport "Drawings", acViewPreview, , "ProjectID = " & Me.ProjectID
End Sub

What i'm I doing wrong?

It's impossible to say given that nobody here has any way to know what's in
your tables or what you have as the Report's recordsource.

The report is NOT based on the form - the form will be used to update data in
your tables, and the report will be based on your tables. What are your
tables? How are they related? Are they being updated correctly by the form? Is
the Report based on a query which retrieves the proper data?
 
A

Arjan

All,

Sorry if I was unclear, the report is indeed based on a query of course!
I have solved the problem, I used the "projectID" form the project table
i.o. the documents table.

Thanks for helping anyway!!

Regards,
Arjan
 

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