473,563 Members | 2,667 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DSum Function With Multiple Criteria in Query

5 New Member
Amount Date-of-payment
450 8/1/11
600 8/2/11
400 8/3/11
870 8/5/11
200 8/1/11
900 8/2/11

I want to get total amount between 8/1/11 to 8/3/11
Oct 2 '17 #1
9 4860
NeoPa
32,564 Recognized Expert Moderator MVP
I'll assume for now that you're posting from America and the dates are all for August rather than the 8th day of various months. Bear in mind that dates written in that form on an international site are ambiguous and lead to confusion and misunderstandin g. There is also no mention of the name of the table or other data source in the question. That's necessary information, of course. Please include all necessary information in any questions.

So, if using DSum(), then you'd want something like :
Expand|Select|Wrap|Line Numbers
  1. X = DSum("[Amount]" _
  2.        , "[NameOfTable]" _
  3.        , "[Date-of-Payment] Between #2011-8-1# And #2011-8-3#")
Oct 2 '17 #2
bfschung
5 New Member
Amount Date-of-payment
450 8/aug/11
600 6/feb/11
400 4/jan/11
870 8/sep/11
200 8/mar/11
900 7/feb/11
table name is "PAYMENTS"

I want to get total amount between ANY 2 DATES. PLZ
Oct 3 '17 #3
NeoPa
32,564 Recognized Expert Moderator MVP
I have no conception of why you'd ask for two specific dates when what you want is to use any two dates. However, you can replace the date literals with prompts if that's your requirement.
Expand|Select|Wrap|Line Numbers
  1. X = DSum("[Amount]" _
  2.        , "[PAYMENTS]" _
  3.        , "[Date-of-Payment] Between [First Date] And [Last Date])
Oct 4 '17 #4
bfschung
5 New Member
Respectd sir, thanks for helping me and giving your precious time to me. but unfortunately this query shows blank "Total" column and worng dates. what should i do sir please?
Oct 6 '17 #5
NeoPa
32,564 Recognized Expert Moderator MVP
BFSChung:
What should I do sir please?
I expect the next step for you would be to include the code you have. If this is VBA that creates SQL please include the SQL produced by the VBA too. If just SQL then please format it as well as you can in a way that's legible (See Before Posting (VBA or SQL) Code).
Oct 6 '17 #6
bfschung
5 New Member
Hi sir,
Sir if i may send you my database, would you pleaze create a query to solve my problem?
Oct 10 '17 #7
NeoPa
32,564 Recognized Expert Moderator MVP
That wouldn't help. Until I have a clear understanding of what you actually require I can't provide a solution for you.

Furthermore, saving yourself the effort of writing out your question fully and properly simply means you expect others to work even harder to help you. I expect you can see why this sort of attitude is not appreciated.

You asked earlier what you should do next, but after I replied you still haven't done that. Even worse, you posted your reply in an article thread - thus damaging both and requiring work to tidy up the mess. You expect a lot but offer little, and this is on your own question.
Oct 11 '17 #8
bfschung
5 New Member
Respected sir,
I want to explain my problem. i have an installment shop. i sell electronics on installments. and all my receivings goes in a table names"PAYMENTS" . This table has fields. "ACCOUNT", "NAME", "AMNTRCVD", "DATED". I want to find receivings of a specific period of times, e.g. month of june, year 2016, etc,. so i may be able to check my balance and receive cash from my manager. i hope you may follow my problem.
Oct 12 '17 #9
NeoPa
32,564 Recognized Expert Moderator MVP
In that case I'll refer you back to my answer in post #4. You just need to change [Amount] to [AMNTRCVD] and [Date-of-Payment] to [DATED] :
Expand|Select|Wrap|Line Numbers
  1. X = DSum("[AMNTRCVD]" _
  2.        , "[PAYMENTS]" _
  3.        , "[DATED] Between [First Date] And [Last Date])
Oct 31 '17 #10

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

Similar topics

0
2101
by: seanseaghan | last post by:
New to this group, so greetings all! I am trying to develop query syntax in Access 2000 to accomplish the following: Imagine you are in an accounting dept. and you are working on a reconiliation of debits and credits. Say you have a table / list that is 1000s of lines long. These could be either debits or credits. Then imagine you...
4
21078
by: ShyGuy | last post by:
I have a table with 4 fields. Three are used for criteria. I can get the DLookup to work with 1 criteria with the following but can't get it to work with 2 or three. NumofAppts = DLookup("", "LookUpAppts", " = " & Forms!!NumofPeople) Can someone tell me how to add multiple criteria? I tried "And" but it doesn't seem to work.
6
6269
by: ckpoll2 | last post by:
Hi, I have made a report that has a query as its record source. I put a text box in there that I want to run a dsum function off of a different query. The criteria that I need to use is that it returns the appropriate number for whatever name appears in the Name text box within the Name Header. Here's the formula I have: ...
3
2983
by: technocraze | last post by:
Hi community experts, I am having an isue with Dsum function that is used to count the total number for a particular field (intake) at the textbox afterupdate event with condition/ criteria (subject). Below is the scenario in details. What I need to do is summing the intake corresponding to what is selected from the dropdown combo box. For...
9
5414
by: BlackJack17 | last post by:
Alright you all have been so helpful with everything else that I thought I'd run one more issue by you. I have put together a report that is driven by a query. This query (Unique Records) returns all unique records in a table (DDRS Data). Each unique record is a string of elements from the table (15 different ones total) and I'm trying to get the...
13
15884
by: 19bam80 | last post by:
I am using a simple DSum function to add donations made by each member of an organization. It looks like this: dTotal = DSum("SplitAmt", "", " = " & Format(lGiftID)) SplitAmt is the field that contains the amount of the donation. GiftSplits is the name of the table. Gift ID is the field that contains the ID number given to each donor. ...
4
2201
by: wassimdaccache | last post by:
dears I have a continuous forms. It contains 2 fields I made another field to check their accounts. it is . the source of is based on a DSUM function. "it is working well" Now I want to filter this form on a criteria where account > 0. It is not working using this code
3
3627
by: kstevens | last post by:
Please help. I know the sysntax is wrong. Here are some details. I am looking for the sum of past shipped items. I originally wrote this Dsum with only one criteria, but because of multiple lineitems with the same number it was adding all of the items with the same ....obviously. So i tried to just find records with multiple criteria........
4
5277
by: DANNYOCEAN | last post by:
I have a code that sucessfully calculates how many numbers are lower than for example 45 , for large sample number list. But i´m looking for a code that have a COUNT function with MULTIPLE CRITERIA such as, for example: i wanna know which are the numbers and how many of them follow the MULTIPLE CRITERIA: OR OR OR and so on until the...
4
2608
Seth Schrock
by: Seth Schrock | last post by:
I'm attempting to use the DSum function to get the sum of selected records. However, when I try to assign this number to a variable, I get error number 3163: The field is too small to accept the amount of data you attempted to add. Try inserting or pasting less data. I have verified that the query string gets the correct results and that the...
0
7659
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7580
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
1
7634
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6244
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5208
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3634
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3618
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2079
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1194
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.