A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Filter in the subform



 
 
Thread Tools Display Modes
  #1  
Old April 28th, 2010, 05:01 PM posted to microsoft.public.access.forms
samotek via AccessMonster.com
external usenet poster
 
Posts: 29
Default Filter in the subform

Can I apply a filter on the subform? With my main form, called frmoffers, I
choose the customer and then with the subform I choose the products.I want to
place a button on my main form to choose the supplier, for example:
strFilter = "products.supplierid = 1"
Me.Filter = strFilter
Me.FilterOn = True

But how can I refer to the subform and can i filter it?

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/201004/1

  #2  
Old April 28th, 2010, 11:05 PM posted to microsoft.public.access.forms
Jeanette Cunningham
external usenet poster
 
Posts: 2,190
Default Filter in the subform

There are a couple of ways to do this.
The easiest way is to have the main form filter on the same field that is
the Link child fields and Link master fields.
This way, when the main form is filtered, the subform is automatically
filtered.

If you are not able to do that, then you can set the subform's filter in
code.

With Me.[SubformControlName]
.Filter = strFilter
.FilterOn = True
End With


Note: the subform control name may be different from the name of the form
*inside* the subform control.
You only need the square brackets if the name of the subform control has
spaces or special characters in it.


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia

"samotek via AccessMonster.com" u15330@uwe wrote in message
news:a736653f72fa6@uwe...
Can I apply a filter on the subform? With my main form, called
frmoffers, I
choose the customer and then with the subform I choose the products.I want
to
place a button on my main form to choose the supplier, for example:
strFilter = "products.supplierid = 1"
Me.Filter = strFilter
Me.FilterOn = True

But how can I refer to the subform and can i filter it?

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/201004/1



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 12:38 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.