Using MS Access/Min If

Advertisement


Question
Hi

I have got a system in a database however there is one part that I can not figure out how to get working.

I have got the concept working in excel, using the formula below

IF(C3>J2,J2,MIN(IF(ISNUMBER(MATCH(ROW($A$6:$A$20),$J$2:$J2,0)),TRUE,IF(ISNUMBER(MATCH(ROW($A$6:$A$20),$C$2:$C2,0)),TRUE,IF(C3>J2,TRUE,ROW($A$6:$A$20))))))

Essentially I have a table as follows,

AutoNumber as TransferNo
Date as TransferDate
CustomerNumber.

In my system the first 5 customers are charged one standard rate with any after at a disocunted rate.

In a month customers will transfer, say customer 1 transfers then customer 6 will then take the standard rate etc.
However customers transfer out of sequence so I cant simply start from 6 and add 1 to each customer that transfers out.

Essentially I need to know for each transfer which customer replaced them at the standard rate, so if transfers are ordered by date it is the min number (greater than 5) which hasnt already been transferred out.

I am having real trouble getting my head around it in access though, is something like this possible?

Answer
I'm not quite following the structure and workflow. What does your app do? How are customer's entered. Is it first come first served with respect to standard/discounted rates? I don't understand; "which customer replaced them at the standard rate".  

Using MS Access

All Answers


Answers by Expert:


Ask Experts

Volunteer


Scottgem

Expertise

I can answer almost all types of questions relating to Microsoft Access usage and application design. My strengths are database and interface design.

Experience

I've been designing databases for over 25 years working with dBase, FoxPro, Approach and Access.

Organizations
Author of Microsoft Office Access 2007 VBA
Techncial Editor for Special Edition Using Microsoft Access 2007 and Access 2007 Forms, Reports & Queries From Que Publishing

Education/Credentials
Brooklyn College BA

©2016 About.com. All rights reserved.