Access Looping? and calculating Gaps

AVILA

New Member
Joined
May 16, 2003
Messages
6
Possibly someone may :rolleyes: ?

Here is my problem. I have a list of members who show up multiple times. My goal is to (1) get the GAPS between "FrmDate" and "ThruDate" by Unique MembID. (2)Tag each unique MembID with 1 or 2 for members withs gaps greater than 45 days.

In example below MembID "1234" would not qualify. So this Membid would have an "0" or "N"

*IS NULL = Still Acitve
-------------------------------------------____RESULTS_____
Membid.....FrmDate...........ThruDate........GAP.....Qualify
1234..........01/01/02..........06/30/03...........0....... 0 or N
1234..........07/15/03..........07/30/03........16........ 0 or N
1234..........08/01/03..........12/31/03...........1....... 0 or N
1234..........02/15/04..........*IS NULL.........45....... 0 or N

9876..........01/01/02..........06/30/03...........0....... 1 or Y
9876..........07/02/03..........*IS NULL...........1....... 1 or Y

4321..........01/01/02..........*IS NULL...........0....... 1 or Y
4321..........07/01/03..........*IS NULL...........0....... 1 or Y

6789..........01/01/02..........06/30/03...........0....... 1 or Y
6789..........01/01/03..........*IS NULL......-180....... 1 or Y


Additional Info: I have everthing in SQL Server and can bring into Access, Excel or Stay in SQL.

Any suggestions would be greatly appreciated!
Thanks!
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
I would say in MS Access you want to create a query with the Member ID, Min of FromDate and Max of ToDate. Save this query, and setup a second query accessing the first, and build a custom formula to do iff(DateDiff("D',MinOfFromDate,Maxoftodate)>45,Y,N) I'm not sure about catching the Null value issue, it might casue some problems.
Hope this helps.
 
Upvote 0
I am not sure that I can follow the logic that you are using to calculate the gap between "FrmDate" and "ThruDate".
However if Null needs to be calculated with todays date you could use the nz() function to do it.
gap = [frmDate]-nz([ThruDate],Date())

I would also score the other way around so that a good result is 0 and a bad = 1, then you can use a grouping query and sum on the scoring field, any score other than 0 will be a "NO"

HTH

Peter
 
Upvote 0

Forum statistics

Threads
1,221,618
Messages
6,160,853
Members
451,674
Latest member
TJPsmt

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top