How do i restrict a report to a specific record on a form?

  • Thread starter SarahAirProducts
  • Start date
S

SarahAirProducts

I am designing a purchasing system. I would like to be able to look at a
specific record, click a button and bring up the confirmation (report) for
that record only. I need to tie it together by PO Number. Thanks.
 
F

fredg

I am designing a purchasing system. I would like to be able to look at a
specific record, click a button and bring up the confirmation (report) for
that record only. I need to tie it together by PO Number. Thanks.

Each record should have a unique prime key field.
If [PO Number] is your unique field, and is Number datatype, then:

DoCmd.OpenReport "ConfirmationReport", acViewPreview, , "[PO Number] =
" & [PO Number]

However, if [PO Number] is Text datatype, then use:

DoCmd.OpenReport "ConfirmationReport", acViewPreview, , "[PO Number] =
'" & [PO Number] & "'"

Change [PO Number] to whatever the actual prime key field is.
 
B

bgreenspan

I am doing something similar. In addition to displaying a specific
record on the form (as you have shown), I'd like a specific
corresponding record on a subform (derived from a linked table). I am
having trouble with the syntax for the linked field.

Thanks.
 
Top