Filter Main form from subform (1 Viewer)

ckiley

Registered User.
Local time
Yesterday, 23:11
Joined
Sep 15, 2005
Messages
10
I have a main form that contains basic project information, and one of many subforms that contains project manager and contract information. (forms and subs linked by project ID) My project managers want to have the ability to only show project records that are theirs. I can make a filter based on any field in the main form without a problem using code like below.

Dim strFilter As String
strFilter = "ILFID Like '*FME*'"
Me.Filter = strFilter
Me.FilterOn = True

How do I write a filter to reference the project manager field in a subform that will actually filter the main form and subform records?

Thanks!
 

vid

Registered User.
Local time
Yesterday, 20:11
Joined
Feb 4, 2010
Messages
62
Hi! I need to do a similar thing for a db i'm creating... Could you find a solution to this problem?? Thanks!
 

MStef

Registered User.
Local time
Today, 04:11
Joined
Oct 28, 2004
Messages
2,251
Hello vid! Send a short example of your mdb, (Access 2000 or 2002-2003, ziped).
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 04:11
Joined
Sep 12, 2006
Messages
15,718
this seems wrong. a sub form should consist of (potentially) multiple items of information related to a certain field (fields) on the main form. (So how can the project manager be on a sub form. Do you have more than 1 project manager per project?)

But anyway, I cannot see that here is any item of information in a subform that can have any effect on information displayed in the mainform, (maybe i'll modify that - nothing that couldn't ALSO be managed directly on the main form)

Either that, or what you are describing as a subform, is not REALLY a sub-form.
 

MStef

Registered User.
Local time
Today, 04:11
Joined
Oct 28, 2004
Messages
2,251
Hello vid!
1) You have no "subform". Tehere is 1 form "Search Form".
2) "Pop up", properties put No.

I suggest to use "Filter By Form" icons.
Look at attachment (word, zip).
 

Attachments

  • FilterByForm5.zip
    121.8 KB · Views: 303

vid

Registered User.
Local time
Yesterday, 20:11
Joined
Feb 4, 2010
Messages
62
Thank you for your quick responses!

I know that the search form has no sub-form.. The edit claims form does... That is the form which is supposed to open up when you click on View All.. Its the form to which the filter is StrWhere is being applied.. Please have a look at it again... Meanwhile I'll try to use what you sent me :) Thanks a ton!!!
 

HiTechCoach

Well-known member
Local time
Yesterday, 22:11
Joined
Mar 6, 2006
Messages
4,357
I have a main form that contains basic project information, and one of many subforms that contains project manager and contract information. (forms and subs linked by project ID) My project managers want to have the ability to only show project records that are theirs. I can make a filter based on any field in the main form without a problem using code like below.

Dim strFilter As String
strFilter = "ILFID Like '*FME*'"
Me.Filter = strFilter
Me.FilterOn = True

How do I write a filter to reference the project manager field in a subform that will actually filter the main form and subform records?

Thanks!

See my suggestion here:

http://www.access-programmers.co.uk/forums/showthread.php?t=193812
 

Users who are viewing this thread

Top Bottom