Filtering Reports

desireemm

Registered User.
Local time
Yesterday, 18:11
Joined
Dec 30, 2003
Messages
64
Hi all I have a database with SQL server as the engine and Access 2003 on the front end (ADP). I am trying to filter reports, for example when a user Types in a TeamMember Number when looking up a record on a form I want them to be able to see the report of that team member also, this code will open the form refering to the record but I would like to get a report to do the same?? How can I do that??

Code:
Private Sub Command231_Click()
On Error GoTo Err_Command231_Click

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "TERMINATION"
    
    stLinkCriteria = "[TM #]=" & Me![TM#]
    DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command231_Click:
    Exit Sub

Err_Command231_Click:
    MsgBox Err.Description
    Resume Exit_Command231_Click
    
End Sub
 
You can use the same coding only, Instead of
Do.Cmd OpenForm
use
Do.Cmd OpenReport
and replace the Form Name with the report name.

You may wish to have a second command button offering your user a choice of the form or the report. Judging by what you said earlier, you may also wish to open the report in print preview rather that printing the report directly.
 
statsman

Ok thank you I'll give that a try
 

Users who are viewing this thread

Back
Top Bottom