Print only the selected record 2 a report

E

Eleonora

Hello there,

I'm trying to print out only the selected record from my form in a report
but each time the same records are printed out.

In the form's header I have the following information to select the record:

Private Sub Combo19_AfterUpdate()
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.Find "[SALESMAN_ID] = " & Str(Nz(Me![Combo19], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub

In the details parte I have:

Private Sub Command16_Click()
On Error GoTo Err_Command16_Click

Dim strDocName As String
Dim strWhere As String
strDocName = "Agents"
strWhere = "[SALESMAN_ID]=" & Me!SALESMAN_ID
DoCmd.OpenReport strDocName, acPreview, , strWhere

[ I also tried:

Dim stDocName As String
Dim strSQL As String

stDocName = "Agentes"
strSQL = "[SALESMAN_ID] =" & Me![SALESMAN_ID]
DoCmd.OpenReport stDocName, acViewPreview, WhereCondition:=strSQL ]

Exit_Command16_Click:
Exit Sub

Err_Command16_Click:
MsgBox Err.Description
Resume Exit_Command16_Click

End Sub

Could the problem be on the report side?
Thanks and regards....
 

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

Top