473,407 Members | 2,629 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

How to display a value from an unrelated query in a report

52
HELP! I'm about to have a total meltdown!

I've been trying all sorts of things to do the following. I have a financial database that contains incomes and expenses. I have it set up so that each entry contains the date deposited, amount, from who, cheque #, etc. Each entry is either an IN (for income) or EX (for expense). I've just created the General Ledger report that shows a chronologic accounting of all entries in a given month. I now want to sum up the incomes and then sum up the expenses. I then want to add the incomes to the start balance, and subtract the expenses. Sound simple? I thought so too!

I've made two queries that output the correct numbers; neither one of them is the underlying query for the report. That query MUST contain all the entries in the given date range and then display them chronologically, as I said. If I could simply group the incomes and expenses, I would have it. But, I cannot. They are all mixed.

So, how do I plunk in a number from the queries I made? I've tried simply using the Expression builder to get to them, but Access doesn't know what they are. I've tried Dsum, DLookup, and can't get them to display the right numbers (always outputs the first entry amount only).

What I REALLY want, while I'm at it, to maintain a running total on the right, that adds things that are incomes and subtracts things that are expenses. That would do it! However, the Running Sum feature in reports only adds. I cannot see how to do it based on a criteria.

Any insights? THANKS! : )
Oct 11 '10 #1
6 2390
NeoPa
32,556 Expert Mod 16PB
DSum() should work for the first part of the question. You don't give examples of how you tried this, so I cannot tell you where you went wrong.

As for a running sum, you can create hidden controls on your report which sum (Running Sum) the calculated values determined by whether or not it is INcome or EXpense. This can be prepared in your bound query.

If you want a single running total, then it is also very easy to produce a value which is negated if the type is an EXpense. Summing these values gives you what you require I think.
Oct 11 '10 #2
Mmmel
52
Thanks, NeoPa!

I'm trying Dsum again; still not working. Can you help me figure out why?

Here are some (better!) details:

The report is based on a Query called "Q: Financials - Date filtered for Reporting", which takes as parameters start and end dates (so I can total in a given month). Each record consists of the Amount as well as whether it is an IN or EX. This is working properly.

The Dsum looks like this:
Expand|Select|Wrap|Line Numbers
  1. =Dsum([Amount], "Q:  Financials - Date filtered for Reporting","[Income or Expense?]='IN'")
which, I think, should sum up everything in the Amount field from the Query "Q: Financials - Date filtered for Reporting" for the records whose criteria matches the "IN" (that I have specified as such). What is wrong? It outputs a total that is massively more than it should be (more than 4 times too big). I cannot even work out HOW it came up with that number. There's no mathematical reasoning that I can see.

Any ideas?
Oct 11 '10 #3
NeoPa
32,556 Expert Mod 16PB
If your query filters by start and end date, then your DSum() call certainly doesn't. I expect that is why you are getting a greater value than anticipated.

Why not try the Running Sum option. That will always work for the data within the confines of any relevant filtering of the report (or query).
Oct 11 '10 #4
THANKS! That's exactly what I did. I actually did TWO, with the control source of each specifying to sum ONLY if it was an IN (and then only if it was an EX). Worked BEAUTIFULLY! Yaye! I didn't know you could do that until I tried it! THANKS so much for your help! I'm all set now!

Happy Canadian Thanksgiving!
Oct 11 '10 #5
NeoPa
32,556 Expert Mod 16PB
Very happy to hear it Melody :-)

Happy Canadian Thanksgiving to you too and Welcome to Bytes!
Oct 11 '10 #6
NeoPa
32,556 Expert Mod 16PB
Melody. I moved your new question to a new thread (Totals Not Correct When Printing Report). I'll do what I can for you from there.
Oct 12 '10 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: SalimShahzad | last post by:
dear gurus, I have one problem. i have listed some cities say london, tokyo, newyork,ALL. now based on the combo selection after update. it pass the value to a report query and results comes of...
1
by: allie357 | last post by:
I am trying to add a form with a combo box to an existing parameter query report. I followed the directions from this link:http://office.microsoft.com/en-us/assistance/HA011170771033.aspx ...
3
by: sfjnet | last post by:
Hi I am relatively new to Access so I hope I am not embarrassing myself with this question. I have created a database showing contract details (contract number, contractors, dates, other...
1
by: viral123 | last post by:
Hi all I am using Crystal report and I am running my report successfully for my query but I want to make my query for one specific date. I want to get the date value from the textbox value. ...
2
by: mervyntracy | last post by:
Hi There, I have recently started coding in asp.net (just 2 and a half days now). I am writing a simple test app that gets data from a data base and displays the value perfectly in the drop down...
6
by: pukhton | last post by:
Hello~ Just a quick question about Access Reports. I want to have a form for user where they will have two textbox and one combo box to pick from and run the query based on that. 1 txtbox is...
2
by: somtabu | last post by:
How to send value from frontend to report in VB.Net Actually I have a form in VB.Net and there is a textbox. Now i want to send the textbox value to Crystal Report. How can i do this? Please help
1
by: yemvee | last post by:
Sir, I have a table named "RELATIONS_MASTER". Content of the table is below. CODE | PARENT | CHILD | LEVEL | -------------------------------------------------------------- A01 |...
1
by: imtmub | last post by:
Hi All, I have mainpage (POselect.aspx). language VB In that page i have a textbox (txtPOId) and command button(Button1) When i press then button its should send the textbox value to Crystal...
4
by: RachH | last post by:
Is there a way to pass a value to a report via VBA so the value can then be displayed in the report as a concantenation with a string? I have a report that displays all pricings that have occured...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.