473,401 Members | 2,068 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,401 software developers and data experts.

DSum Function With Multiple Criteria in Query

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

✓ answered by NeoPa

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])

9 4848
NeoPa
32,556 Expert Mod 16PB
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 misunderstanding. 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
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,556 Expert Mod 16PB
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
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,556 Expert Mod 16PB
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
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,556 Expert Mod 16PB
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
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,556 Expert Mod 16PB
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
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...
4
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("",...
6
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...
3
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...
9
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...
13
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...
4
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...
3
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...
4
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...
4
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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,...
0
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...
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.