slyvsspy
Registered User.
- Local time
- Today, 21:40
- Joined
- Jun 24, 2002
- Messages
- 51
here is my code and I was wanting to know how to attach this filter that I have make called 'josh' to the report i'm opening because I want the report to only have the records that are on the form.
Private Sub Command50_Click()
josh = "VOTERID>' '"
If Me.PrimaryButton.Value = True Then josh = josh + " and PRIMARY > ' '"
If Me.RepublicanButton = True Then josh = josh + " and REP > ' '"
If Me.DemocratButton = True Then josh = josh + " and DEM > ' '"
If Me.IndependentButton = True Then josh = josh + " and IND > ' '"
If Me.PrecinctButton > "' '" Then josh = josh + " and PRECINCT = forms!multipleselectform!precinctbutton"
If Me.LastVoteButton > "' '" Then josh = josh + " and LASTVOTERG >= forms!multipleselectform!lastvotebutton"
Me.Filter = josh
Me.FilterOn = True
Dim stDocName As String
stDocName = "multipleselectreport"
DoCmd.OpenReport stDocName, acPreview
On Error GoTo Err_Command50_Click
Exit_Command50_Click:
Exit Sub
Err_Command50_Click:
MsgBox Err.Description
Resume Exit_Command50_Click
End Sub
how do I write the line
DoCmd.OpenReport stDocName, acPreview
and attach the "josh" filter??
Private Sub Command50_Click()
josh = "VOTERID>' '"
If Me.PrimaryButton.Value = True Then josh = josh + " and PRIMARY > ' '"
If Me.RepublicanButton = True Then josh = josh + " and REP > ' '"
If Me.DemocratButton = True Then josh = josh + " and DEM > ' '"
If Me.IndependentButton = True Then josh = josh + " and IND > ' '"
If Me.PrecinctButton > "' '" Then josh = josh + " and PRECINCT = forms!multipleselectform!precinctbutton"
If Me.LastVoteButton > "' '" Then josh = josh + " and LASTVOTERG >= forms!multipleselectform!lastvotebutton"
Me.Filter = josh
Me.FilterOn = True
Dim stDocName As String
stDocName = "multipleselectreport"
DoCmd.OpenReport stDocName, acPreview
On Error GoTo Err_Command50_Click
Exit_Command50_Click:
Exit Sub
Err_Command50_Click:
MsgBox Err.Description
Resume Exit_Command50_Click
End Sub
how do I write the line
DoCmd.OpenReport stDocName, acPreview
and attach the "josh" filter??