Use controls from separate forms as parameters in same query (1 Viewer)

Sketchin

Registered User.
Local time
Today, 13:07
Joined
Dec 20, 2011
Messages
575
Hello,

I am going to struggle to describe what I am doing, but here goes:

I have 3 forms that all use the same sub form. The 3 main forms show 3 different project types, where the sub form shows what other projects that a company is engaged with. Rather than create 3 different queries for my sub form, i would like to just filter it using criteria that looks at the CompanyID field on my 3 main forms. Currently my criteria is like this:

[Forms]![frmProjects_Detail_IND]![txtcompanyid] Or Like [Forms]![frmProjects_Detail_CSS]![txtcompanyid] Or Like [Forms]![frmProjects_Detail_TAP]![txtcompanyid]

Is there a way to ignore the parameters that are null?
 

jdraw

Super Moderator
Staff member
Local time
Today, 16:07
Joined
Jan 23, 2006
Messages
15,379
So, if I'm reading and understanding, you have 3 types of Projects (IND, CSS and TAP). What is the recordsource for these 3 forms for these ProjectTypes. How is the MainForm related to the subform?
 

Sketchin

Registered User.
Local time
Today, 13:07
Joined
Dec 20, 2011
Messages
575
The record sources are 3 queries that are pulling data from the same projects table. I only need certain fields for certain projects, so i only query the fields I need. On top of that, I am filtering on the project type.

I have a subform that shows ALL other projects that a company is involved with. It only shows a snapshot of each project, therefore the same subform and its criteria is identical on each main form.
 

Sketchin

Registered User.
Local time
Today, 13:07
Joined
Dec 20, 2011
Messages
575
I also realize that I could just copy past the subform query and put criteria referencing each main form, and then also build 3 separate subforms that point at the queries, but I am trying to keep things a bit tidier.
 

Users who are viewing this thread

Top Bottom