Query Filteration - From A Form

  • Thread starter Faraz Ahmed Qureshi
  • Start date
F

Faraz Ahmed Qureshi

I want a query to return a result after filteration upon the basis of entries
as per the entry in ID of either the form "Clnt" or the form "Trans",
whichever is opened.

However, if the "Trans" form is open the following query still asks for the
Parameter Value "[Forms]![Clnt]![SetAc].[Form]![ID]" and ends if Cancel
pressed.

SELECT COA.AcNo, COA.Acc, COA.Set
FROM COA
WHERE (((COA.Set)=[Forms]![Clnt]![SetAc].[Form]![ID]) Or
((COA.Set)=[Forms]![Trans]![ID]));

How 2 overcome/resolve the same?
 
A

Allen Browne

You can't do that.

You've asked Access to evaluate two expressions. The query passes the first
expression to the Expression Service. If the first form is open, the ES
returns the value. If not it pops up the parameter dialog. Then it passes
the second expression to the ES, and the same thing happens. Therefore, the
only case where no parameter dialog appears is when *both* forms are open.

I take it from your question that you want to resolve either, not both.
Therefore you cannot use a parameter in the query. You must use another
approach, e.g.
- different queries for each form, or
- omit the parameters from the query, and apply a filter to the form
instead.
 
J

Jerry Whittle

Both the "Clnt" AND the "Trans" forms need to be open. However they can be
minimised or even hidden. When you open up the Trans form, you could have it
open the CInt form and hide it. The same could happen with the CInt form
opening the Trans form as hidden.

Put code in the Open event of the Trans form:

DoCmd.OpenForm "Clnt", acNormal, , , acFormEdit, acHidden

Do something similar for the CInt form.
 
D

De Jager

Faraz Ahmed Qureshi said:
I want a query to return a result after filteration upon the basis of
entries
as per the entry in ID of either the form "Clnt" or the form "Trans",
whichever is opened.

However, if the "Trans" form is open the following query still asks for
the
Parameter Value "[Forms]![Clnt]![SetAc].[Form]![ID]" and ends if Cancel
pressed.

SELECT COA.AcNo, COA.Acc, COA.Set
FROM COA
WHERE (((COA.Set)=[Forms]![Clnt]![SetAc].[Form]![ID]) Or
((COA.Set)=[Forms]![Trans]![ID]));

How 2 overcome/resolve the same?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top