Subform always loads filtered

floydman

Registered User.
Local time
Today, 05:47
Joined
Aug 29, 2007
Messages
16
I have a main form with a subform, the subform RecordSource is set in VB. When the main form opens the subform shows no data. When I right click on the subform and choose Remove Filter/Sort, the correct data appears based on the RecordSource query I set in the code.

The final few lines in Sub Form_Load() are:

Me.RecordSource = strSQL
Me.FilterOn = False
Me.Requery

Stepping through and watching the locals I can see the RecordSource being set correctly and the FilterOn is always False, the Filter Property is "". I've even tried Me.Refresh but the Subform won't show data until I right click and Remove Filter/Sort.

Anyone any ideas what I'm missing here ?

Many thanks.
 
Your main form might be trying to filter your subform?
 
Be aware that a subform Form_Open() event occurs BEFORE the main Form_Open() event. Check that your main form is not overriding your subform settings.
 
Don't think the Main Form is overriding the SubForm because when I check the properties of the subform after it opens it has the correct RecordSource and has no Filter value (this is true when I check properties before I right click and select Remove Filter/Sort on the SubForm).

What is the Remove Filter/Sort actually doing ? Is it setting FilterOn=False ? or doing something else ?

Also have tried setting the SubForm AllowFilters property to No and it still loads filtered.
 
Hi Rich, The Filter property of the subform is blank. I have some other info also, when I choose Sort Ascending or Sort Descending by right clicking on the Subform (its in datasheet view) the data appears also, so maybe the Filter is a red herring here, I can't seem to find any sort properties though so not sure how this is being set.

Steve
 

Users who are viewing this thread

Back
Top Bottom