Solved

Field criteria based on other fields value.

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

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

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

It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

752 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