Solved

Field criteria based on other fields value.

Posted on 2011-09-09
5
485 Views
Last Modified: 2013-11-28
Hi,

I'm struggling with the following problem (hope it makes sense):

I'm making a report that shows gross weight sum for a customer. This is listed in columns per month (Jan-Des) and ArticleNo in rows. I've made a crosstable query that extract the information I need and made a report based on that query.

My problem occurs when I'm trying to make totals in the bottom. The totals for the gross weight is no problem using the Sum function, but I'm also supposed to have a sum of the charged amount of money per month.

I didn't find a way to make a function to ask another query than the record source query, and tried the following:

One crosstable query which extracts  sales with weight sum per article number.
Another crosstable query which extracts sales with the charged amount per article number
A select query that asks for customer no and year, and with reference to the two crosstables with fields for all months from both.

Works fine, except that the report is really slow. Running one crosstable takes 20 seconds. Running the select query takes 3 minutes.

But after congratulating myself with the success, I come into another problem. For the first crosstable I want to restrict the query to show ArticleGroup "3" only. No problem to make that criteria in the first crosstable query. But when I run the select query, I get the sums for all article groups from the month fields from the first crosstable (and of course the second crosstable which should show all the article groups).

Any suggestions what I can do to make this work? Thanks in advance!
0
Comment
Question by:WiserG
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 77

Expert Comment

by:peter57r
ID: 36515477
I think some pictures would help here.
I find it quite hard to hold all this iin my fading brain in one go.
0
 
LVL 30

Expert Comment

by:hnasr
ID: 36531930
Try to attach a simple sample database with few test data and the expected output.
0
 

Author Comment

by:WiserG
ID: 36534861
Did a workaround to fix it. Instead of merging the crosstables, I made several reports and merged the reports into one report based on subreports.

I'm still struggling with the speed issue. I'm using the following queries:

-Main query (filter on customer number and year)
--subquery 1 - crosstable - weight data for article group 1 pr month
--subquery 2 - crosstable - weight data for article group 2 pr month
--subquery 3 - crosstable - cost data for article group 1,2,3 pr month
--subquery 4 - chart data

All queries runs in a few seconds, 2-6. But when running the unbound report with subreports for the 4 queries takes 2-4 minutes. Any ideas how to speed this up?

0
 
LVL 31

Accepted Solution

by:
Helen_Feddema earned 500 total points
ID: 36551092
Sometimes you can get around this problem by using a make-table query to run the code.  It can be run (depending on how often the data needs to be refreshed) from an AutoExec macro, or from a button on the main menu that opens the report, or a button on a form where the data is updated.  Then use the make-table query as the report's record source.
0
 

Author Comment

by:WiserG
ID: 36554408
Thanks Helen.

Looks as the queries was rebuilt so often from it's ODBC source, that a make-table for the selection did miracles to the report.

From 2 minutes to 13 seconds! Thanks!!!
0

Featured Post

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question