Link Criteria in Report

G

Guest

Hi, there,

I am working on an invoice form, and I made a report form instead of using
form print function.

I used a blank report to create the invoice report.

When I preview the report from invoice form view, it displays the first
record, not current record in form view. Moreover, it also displays all
invoice detail records, not specific records which belong to a specific
customer in the same invoice form view.

The invoice form has a invoice detail subform which contains items and prices.

Key fields in the form
[invid] invoice id
[invcid] invoice customer id
[indid] invoice detail id
[iid] item id

I think I may solve this problem by directing link criteria ([invid]) from
the invoice form view to the invoice report, or I maybe wrong.

It displays the first record of the invoice table and all records from
invoice detail table now, please help.

Thank you very much for your time.
 
R

Rob Parker

Hi Stephen,

Presumably you opening the report via code, using a DoCmd.OpenReport
statement. Add a Where parameter to the command, as follows:
DoCmd.OpenReport "YourReportName", , , "invid = " & Me.invid

If invid is a text field, rather than a number, you will need single-quote
delimiters around the invid:
DoCmd.OpenReport "YourReportName", , , "invid = '" & Me.invid & "'"
[Expanded for clarity, that last line is:
DoCmd.OpenReport "YourReportName", , , "invid = ' " & Me.invid & " '
]

HTH,

Rob
 
G

Guest

Thank you Rob.

It works like magic.

Rob Parker said:
Hi Stephen,

Presumably you opening the report via code, using a DoCmd.OpenReport
statement. Add a Where parameter to the command, as follows:
DoCmd.OpenReport "YourReportName", , , "invid = " & Me.invid

If invid is a text field, rather than a number, you will need single-quote
delimiters around the invid:
DoCmd.OpenReport "YourReportName", , , "invid = '" & Me.invid & "'"
[Expanded for clarity, that last line is:
DoCmd.OpenReport "YourReportName", , , "invid = ' " & Me.invid & " '
]

HTH,

Rob


Stephen said:
Hi, there,

I am working on an invoice form, and I made a report form instead of using
form print function.

I used a blank report to create the invoice report.

When I preview the report from invoice form view, it displays the first
record, not current record in form view. Moreover, it also displays all
invoice detail records, not specific records which belong to a specific
customer in the same invoice form view.

The invoice form has a invoice detail subform which contains items and
prices.

Key fields in the form
[invid] invoice id
[invcid] invoice customer id
[indid] invoice detail id
[iid] item id

I think I may solve this problem by directing link criteria ([invid]) from
the invoice form view to the invoice report, or I maybe wrong.

It displays the first record of the invoice table and all records from
invoice detail table now, please help.

Thank you very much for your time.
 

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