R
Renee
Hello all,
Here is the code on a command button on the parent form:
Dim strFilter As String
Dim strAgent As String
'Build criteria string for agent field
If IsNull(Me.Agent) Then
strAgent = "Like '*'"
Else
strAgent = "= '" & Me.Agent.Value & "'"
End If
'Combine criteria string into a WHERE clause
strFilter = "Name " & strAgent
'Apply the WHERE clause
CurrentDb.QueryDefs("qry_Sales").SQL = "SELECT " & _
"tbl_Sales.RecordID, " & _
"tbl_Sales.Name, " & _
"tbl_Sales.Product, " & _
"tbl_Sales.Quantity, " & _
"tbl_Sales.Date, " & _
"tbl_Sales.Price " & _
"FROM tbl_Sales " & _
"WHERE " & strFilter & ";"
'Requery the subForm
Me!Sales.Requery
When I select different sales agents and click apply, nothing happens. If I
select an agent, then go into design view and click right back to form view,
the sub form (pivot chart) is updated.
Any suggestions would be greatly appreciated!
Here is the code on a command button on the parent form:
Dim strFilter As String
Dim strAgent As String
'Build criteria string for agent field
If IsNull(Me.Agent) Then
strAgent = "Like '*'"
Else
strAgent = "= '" & Me.Agent.Value & "'"
End If
'Combine criteria string into a WHERE clause
strFilter = "Name " & strAgent
'Apply the WHERE clause
CurrentDb.QueryDefs("qry_Sales").SQL = "SELECT " & _
"tbl_Sales.RecordID, " & _
"tbl_Sales.Name, " & _
"tbl_Sales.Product, " & _
"tbl_Sales.Quantity, " & _
"tbl_Sales.Date, " & _
"tbl_Sales.Price " & _
"FROM tbl_Sales " & _
"WHERE " & strFilter & ";"
'Requery the subForm
Me!Sales.Requery
When I select different sales agents and click apply, nothing happens. If I
select an agent, then go into design view and click right back to form view,
the sub form (pivot chart) is updated.
Any suggestions would be greatly appreciated!