Event Procedure for the Preview Report

G

Guest

Hi:
I currently have a Command Button on a Form that is used to Preview a report
of a table that consist of about 260 rows in Access. There are about 15
field names in this table. In the Event Procedure for the Preview Report
command button is there a way to add a feature that will ask for a specifc
result on the Field Name: Topic ID (e.g. A01), so when the report is
previewed only the rows specifc to that parameter will appear and not the
entire 260 rows?

Private Sub Command130_Click()
On Error GoTo Err_Command130_Click

Dim stDocName As String

stDocName = "LOV_tbl"
DoCmd.OpenReport stDocName, acPreview

Exit_Command130_Click:
Exit Sub

Err_Command130_Click:
MsgBox Err.Description
Resume Exit_Command130_Click

End Sub
 
M

Marshall Barton

CP said:
I currently have a Command Button on a Form that is used to Preview a report
of a table that consist of about 260 rows in Access. There are about 15
field names in this table. In the Event Procedure for the Preview Report
command button is there a way to add a feature that will ask for a specifc
result on the Field Name: Topic ID (e.g. A01), so when the report is
previewed only the rows specifc to that parameter will appear and not the
entire 260 rows?

Private Sub Command130_Click()
On Error GoTo Err_Command130_Click

Dim stDocName As String

stDocName = "LOV_tbl"
DoCmd.OpenReport stDocName, acPreview


Check Help for the WhereCondition argument of the OpenReport
method. E.g.

DoCmd.OpenReport stDocName, acPreview, , "[Topic ID]='A01'"
 

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