Hi Guys,
I am trying to open the filtered form in report view but I don't understand why it's not working. Could you please tell me where is the problem in my code ?
I just want to open the form in print preview and if I filtered something in that form then I want to open that filtered form in print preview also.
Here is my code.
I am trying to open the filtered form in report view but I don't understand why it's not working. Could you please tell me where is the problem in my code ?
I just want to open the form in print preview and if I filtered something in that form then I want to open that filtered form in print preview also.
Here is my code.
Code:
Private Sub Command25_Click()
Dim strSearch As String
Dim strText As String
'strText = Me.TxtBox.Value
If IsNull(Me.TxtBox.Value) Or Me.TxtBox = "" Then
MsgBox "Please type in your search keyword.", vbOKOnly, "Keyword Needed"
Me.TxtBox.BackColor = vbYellow
Me.TxtBox.SetFocus
Else
strText = Me.TxtBox.Value
strSearch = "SELECT * from Qery_PVT_Demand_Forecast where ((Support_Status like ""*" & strText & "*"") or (BUOrgKey like ""*" & strText & "*""))"
Me.RecordSource = strSearch
Me.TxtBox.BackColor = vbWhite
End If
End Sub
' Command to open the filtered Report in Print Preview
Private Sub cmdOpenReport_Click()
DoCmd.OpenReport "[Rpt_PVT_Demand_Forecast]", acViewPreview, , Me.Filter
End If
End Sub
Comment