cmd button to open rpt on current client

  • Thread starter Thread starter nydia
  • Start date Start date
N

nydia

I have a dba that keeps track of clients, each week a
report is printed of the clients progress notes. i used
the cmd button wizard to create a button to open rptweekly
on my form, but when the button is pushed it opens the
report for all the clients. how can i set it up to only
open the report for the current client in my form
 
In the button click event, add the following code (substituting your names
as needed)- the linking criteria here is the project ID on the form linked
to the project ID on the report....

On Error GoTo Err_cmdOpenReport_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "ReportInfo"

stLinkCriteria = "[ProjectID]=" & Me![ProjectID]
DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria

Exit_cmdOpenReport_Click:
Exit Sub

Err_cmdOpenReport_Click:
MsgBox Err.Description
Resume Exit_cmdOpenReport_Click
 
Back
Top