Open Report

  • Thread starter Thread starter fatcat
  • Start date Start date
F

fatcat

I can use the wizard to create a button to
open "rptInvoice" FROM my Order form however i want the
report to display only the current order. And then print
please help
FC
 
HI fatcat

I would assume on your order form you have the a field
such as <Date of order> or something like that. Well if
you want you report to show just the current order, create
a parameter value in the underlying query on which your
report is based.

In your query, go to the date field and in the criteria
for the order date enter [Which Date?] or a question along
those lines.

When you run the report it will then ask you Which date?
you put in the date of the order you want your report will
only show orders for this date. if orders are not date
specific you can use this same principle for other
fields. Maybe you have and order number for each order.
Then you can get you query to ask for an order number in
the same way as the date.

because im just a normal user I may not have explained
myself very well, i may be way off the mark but hope it
help anway.

james
 
Your table should have a unique prime key field.

If so, code the command button's Click event:
DoCmd.OpenReport "rptInvoice", acViewPreview, , "[RecordID] = " & [RecordID]

The above assumes a [RecordID] field that is a Number Datatype.

If [RecordID] is Text Datatype, then use:

"[RecordID] = '" & [RecordID] & "'"

as the Where clause.
Change [RecordID] to whatever the actual field name is that you are
using.

See Access Help files for:
Where Clause + Restrict data to a subset of records'

To print without previewing the report, change acViewPreview to
acViewNormal.
 
Back
Top