Query with conditional form criteria

JohnGo

Registered User.
Local time
Today, 10:22
Joined
Nov 14, 2004
Messages
70
I have a query which is used in two forms.
Both forms share the same subform and the query depends on a value in the subform.
I have to declare the whole form (form>subform>control) in the query and would like to switch between the 2 forms depending on which of them is the active form. This because of coding/object efficiency.

So I made a simple statement:

IIf("Me"=[Forms]![FRM_SALES];[Forms]![FRM_SALES]![Companylookup]![REL_ID];
[Forms]![FRM_RELATIONS]![Companylookup]![REL_ID])

It seems access isn't able to verify the Me within the IIf because it keeps
prompting me the value of the form which isn't active.

Does anybody know how to raise a condition within a query depending on the
active form?
 
Hi there I was just wondering if you ever managed to find a solution to this problem since I am currently trying to do the same thing?
 
Out of curiosity...

Why not have a separate query for each subform? Why go to the trouble of determining which form is attaching the query?
 
I do at the moment, but I could effectively halve my number of queries if there was an easy way to solve this.

JC3
 

Users who are viewing this thread

Back
Top Bottom