How do I make a Button locate a report with a specifc Id Number? .

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to get my Report button to reconize the Id or specific file that
I am in, so when I click the button it goes to that report. When I do it now
it only goes to the first report in the database. And when I print, it prints
all the reports in the database unless i change the print properties. Please
does anyone know how I can fix this problem?
 
Well, this is not a "problem". You are telling it to print a report, and it
is doing so. No problem.

To do what you want, you'd have to put code similar to the following in your
button's "click" event...


Private Sub Print_Button_Click()

If (IsNull([UserID])) Then

' Verify the key field (UserID) has a selection

Exit Sub

End If

DoCmd.OpenReport "SomeReportName", acViewNormal, "","[UserID] =
Forms![frmSomeFormName]![UserID]"

End Sub



Rick B
 
The file that you are in is the database that you opened. Your terminology
doesn't map to Microsoft Access terminology.

If you mean that you have a FORM Open with a RECORD showing and you want to
print a Named REPORT based on just that RECORD then see the OpenReport
Method in Access Help.

If that wasn't the case then post back and explain what it is you're trying
to do using Access terminology.

HTH
 
Back
Top