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

Want date paid to return value based on range of dates in another table.

I have two tables in Access 2016. The first table (DUES)lists the ID number, Amount paid and the date paid. The records in this table are constantly updated as new payments are received. Each record in this table is a separate payment - usually one payment per person, but occasionally someone will make two partial payments.

The second table (AMOUNT) lists the starting date, ending date, and the minimum amount due. This table is usually static, but the time frame between the start and end dates for each payment range is not a regular period of time. Each record is a new range of dates with new minimum amount due.

What I need is to have Access compare the most recent date paid in the DUES table with the range of dates in the AMOUNT table and then return the minimum amount due for that date range.

I don't care if this is done as a query, or if a new table/field is created. I would think that this should be an easy thing for Access to do, but I am having no luck in getting it to work.
Nov 21 '16 #1
1 872
jforbes
1,107 Expert 1GB
I think they way your data is structured is preventing this from being a simple solution. It makes logical sense to humans to split up your data in this manner, but it would basically take a human to reconcile the two tables.

I think you would be better off if you were to make one Transaction table where you post Debits and Credits against your users Account, then you can more easily create a Query that calculates the Balance for any given Date.

Expand|Select|Wrap|Line Numbers
  1. ACCOUNT TRANSDATE TRANSAMOUNT DETAIL
  2. Bob      1/1/2016    -200     January Dues
  3. Bill     1/1/2016    -200     January Dues
  4. Frank    1/1/2016    -200     January Dues
  5. Bill     1/1/2016      50     Payment
  6. Bob      1/5/2016     200     Payment
  7. Bill     1/8/2016      50     Payment
  8. Bill     1/15/2016     50     Payment
  9. Bill     1/21/2016     50     Payment
  10. Frank    1/20/2016    400     Payment
  11. Bob      2/1/2016    -200     February Dues
  12. Bill     2/1/2016    -200     February Dues
  13. Frank    2/1/2016    -200     February Dues
  14.  
Doing something like this would give you the Balance for January 31st:
?DSUM("TRANSAMOUNT ", "Transations", "TRANSDATE<=#1/31/2016#")

This would give you the Balance for Bob on January 31st:
?DSUM("TRANSAMOUNT ", "Transations", "ACCOUNT='Bob' AND TRANSDATE<=#1/31/2016#")

This would give Bob's current Balance:
?DSUM("TRANSAMOUNT ", "Transations", "ACCOUNT='Bob'")

You could also create a Query to perform your calculations. You could include a GROUP BY to group the totals by Month. You could even create a crosstab query to give you fancy totals.
Nov 23 '16 #2

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

Similar topics

11
by: igor.lautar | last post by:
Hi, How can I get the address of return value in function? ex. int function(int argument) { int *arg_address; int *rtn_address;
7
by: rcamarda | last post by:
I wish to build a table based on values from another table. I need to populate a table between two dates from another table. Using the START_DT and END_DT, create records between those dates. I...
1
by: chetan29 | last post by:
hello freinds, I have written a store proc, which update a table in AS400, i want to know how can i make sure the update statement is successful or not. depending on successful flag i want to set...
3
by: Andz | last post by:
I'm using explode() to extract and make an array() readable. I'm able to make the array() from dbase readable. categories_table { catid name 1 'test1' 2 'test2' 3 'test3'
2
by: tomash | last post by:
Hi! I ve got two tables in Access 2007. I want to update a field of DataTable from another table, DataSumTable when two of their fields equals. ( the fields : Name and Period) I tried this...
1
by: zoeb | last post by:
Currently I have a table, and would like the calculate a field in the table by referencing values from another 3 tables. i.e. tblData Index1, Index2, Index3, Value 1 2 3 2...
12
by: klbrownie | last post by:
Hello, I am trying to get a date field to autofill based on the date of another date field. I want the autofilled date to be 30 days after the other date. For example, if the user has entered...
7
by: katep74 | last post by:
I am trying to retrieve a date value from the first row of a table using VBA. I have got as far as Dim RepDate as Date RepDate = DLookup("ReportDate", "tblMain") but I can't work out how to...
5
by: CD Tom | last post by:
Here's my problem. I have a person in New Zealand that I'm having problems with the date. Everything works fine except I have a date field in one form that updates another table with the date. I'm...
3
by: debo sniffa | last post by:
I want to add a value from a record in Table A to a record in table B if the value is same as 2 other fields in the Table A. How could i get this done in access?? Pls help me... ;-)
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...
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
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...
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.