Filter a Report within Form

M

Mikk

I have a form which encompasses 140 records. I would
like to have a user browse the form and upon coming to a
particular record the user would have the ability to pull
up the report which filters only the record that they are
browsing.

I used the wizard to install a command button in my form
but do not know how to integrate the filtering process.
Any help would be appreciated.

Dim stDocName As String

stDocName = "rptCRASummary"
DoCmd.OpenReport stDocName, acPreview
 
F

fredg

Mikk said:
I have a form which encompasses 140 records. I would
like to have a user browse the form and upon coming to a
particular record the user would have the ability to pull
up the report which filters only the record that they are
browsing.

I used the wizard to install a command button in my form
but do not know how to integrate the filtering process.
Any help would be appreciated.

Dim stDocName As String

stDocName = "rptCRASummary"
DoCmd.OpenReport stDocName, acPreview

Mukk,

Dim stDocName As String
stDocName = "rptCRASummary"
DoCmd.OpenReport stDocName, acPreview, , "[RecordID] = " & Me![RecordID]

The above assumes [RecordID] is the name of the unique prime key field
of your table and is a Number DataType, and is included in the form and
in the report.

If [RecordID] is text datatype, then use:
"[RecordID] = '" & [RecordID & "'"

Change [RecordID] to whatever the actual name of the prime key field is.
 
T

Tom Ross

AirCode--not sure of number of commas in last statement

Dim stDocName, stCriteria As String

stDocName = "rptCRASummary"
stCriteria = "where statement here without WHERE keyword"
DoCmd.OpenReport stDocName, , , strcriteria
 

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