Fitler Subform

fpendino

Registered User.
Local time
Today, 02:57
Joined
Jun 6, 2001
Messages
73
It's been a while since using Access. Been doing ASP.net and SQL. I have a form with a subform. I'm trying to filter the subform which is disabled, with the value from a listbox.

On the double click of the listbox I have... frmTeamEdit is the subform

Forms!frmTeamMaintenance!frmTeamEdit.Form.Filter = "[TeamID] = " & Me.lstTeams
Me.frmTeamEdit.Enabled = True
Me.frmTeamEdit.Form.DataEntry = False

It is displaying only the first record in the table. It's showing the filter in the property window, but is not actually filtering.

Thanks in advance!
 
Nevermind, I just changed the Recordsource of the form instead
 
You COULD have gotten it to work if you just added one line:

Forms!frmTeamMaintenance!frmTeamEdit.Form.Filter = "[TeamID] = " & Me.lstTeams
Forms!frmTeamMaintenance!frmTeamEdit.Form.FilterOn = True
 
Unless it's been changed in newer versions filtering the subform via vba doesn't work as expected;)
 
Unless it's been changed in newer versions filtering the subform via vba doesn't work as expected;)

I've had it working great with no problems (Access 2000, 2003)
 
You cannot use the ApplyFilter action to apply a filter to a subform. If
you try to do so, the filter is applied to the main form instead. In
Microsoft Access version 1.x, you can achieve some of this functionality

by basing the subform on a parameter query. In the other versions of
Microsoft Access, you can get the same results by changing the subform's
RecordSource property.



Copyright (c) Microsoft Corporation. All rights reserved.

I guess it's time for an upgrade:o
 
You cannot use the ApplyFilter action to apply a filter to a subform. If
you try to do so, the filter is applied to the main form instead. In
Microsoft Access version 1.x, you can achieve some of this functionality

by basing the subform on a parameter query. In the other versions of
Microsoft Access, you can get the same results by changing the subform's
RecordSource property.



Copyright (c) Microsoft Corporation. All rights reserved.

I guess it's time for an upgrade:o

But, while you can't use DoCmd.ApplyFilter you CAN use:
Code:
Forms!YourMainform.YourSubformContainer.Form.Filter = "Whatever"
Forms!YourMainform.YourSubformContainer.Form.FilterOn
and THAT works.
 

Users who are viewing this thread

Back
Top Bottom