Problems with DCount

Newman

Québécois
Local time
Today, 02:26
Joined
Aug 26, 2002
Messages
766
I have a report in which I show powerlines, there sections and the structures in these sections. The filter comes from a dialog form where the user can build a complicated LinkCriteria.

The report source is a query that uses:
3 Access tables (Lines, Sections and Structures);
1 Oracle table (Structures_Restrictions) in which there is a field called "Restriction_A" (which shows the restriction number if any)[Note that this Oracle table isn't mine. It is linked in reading only];
1 sub-query telling which lines have structures with restriction-A ;
1 sub-query telling which sections have structs with restriction-A.

Now, I placed these DCounts at the end (That is just some of them. I have many many more):
How many lines total?
DCount(LineNumber from Lines where FILTER)
How many lines without restriction-A?
DCount(LineNumber from Sub-query#1 where FILTER)
How many sections total?
DCount(SectionNumber from Sections where FILTER)
How many sections without restriction-A?
DCount(SectionNumber from Sub-query#2 where FILTER)

The problem is that my filter doesn't always apply within the tables and/or queries used.
Ex.: The user selects "Structures from 2001" on the dialog form. This information is set in the Structures table but not in the Lines table. So the first DCount (LineNumber from Lines where FILTER) won't work!

I've tried to use the report or the query in my DCount, but the first one gave me errors, and the second one gave me numbers way to high.

Also, if no filter was made from the dialog form, the "Where FILTER" from the DCount won't work either. What should I do?

Thank you for your helping hand!
See you!
Newman
 

Users who are viewing this thread

Back
Top Bottom