Help ASAP

  • Thread starter Thread starter Drew
  • Start date Start date
D

Drew

ok i need help with printing a report for the person i
have in my current form view without entering in a
parameter for the report such as last name or what not.
the reason why i need this is to save time from entering
in a parameter and then printing.
 
Drew,

You will need to add a Where Condition to the OpenReport method so that the
report shows only the information for the record displayed on your form.
Just insert one of the following samples in the Click event of a command
button:

' This works when your matching field is text
Dim strCriteria As String
strCriteria = "[Person_ID ] = " & Chr(34) & Me!Person_ID & Chr(34)
DoCmd.OpenReport "MyReport", acViewPreview, , strCriteria

' This works when your matching field is a number
Dim strCriteria As String
strCriteria = "[Person_ID ] = " & Me!Person_ID
DoCmd.OpenReport "MyReport", acViewPreview, , strCriteria
 
Back
Top