Solved

Field criteria based on other fields value.

Posted on 2011-09-09
5
503 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

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

627 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