Filter a Report within Form

  • Thread starter Thread starter Mikk
  • Start date Start date
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
 
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.
 
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
 
Back
Top