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
 

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

Back
Top