In this tutorial you will learn how to use the DMIN Function.
Take an example Table of Customers.
CustomerT
CustomerID
FirstName
LastName
Phone
CustomerSince
CreditLimit
DaysGrace
IsActive
1
Richard
Rost
7165557777
01/01/2012
1001
1
True
2
Joe
Smith
7165553434
01/03/1990
500
5
True
3
Suzan
Jones
5624365146
02/01/1998
1500
2
False
4
Alan
Watson
4193891212
17/05/2012
50
3
True
5
Anna
Picore
713236479
05/05/2005
1020
4
True
6
Ronald
Simms
7807465468
04/04/1992
50
2
True
7
Donald
Barker
4164415555
01/03/1998
250
5
True
8
Benny
Sperduti
7167267262
06/04/1999
1600
7
False
9
Pete
Smith
5645597777
04/04/2000
500
3
False
10
Barbra
Peters
8292827288
31/12/2005
50
1
True
11
Joe
Jones
5495465466
01/06/2004
500
3
True
14
Pezz
Dispo
26/09/2012
0
4
True
16
Bob
Smith
04/10/2012
0
9
True
In this example we will find what the minimum number of days grace any of our Customers have.
Like the DMax or some of the Domain Functions we don't need a Criteria.
The DMIN function returns a value from a specified set of records (or domain) containing the minimum value.
=DMIN(Field, Domain, Criteria)
Query
The results using a Query would be
SELECT DISTINCT TOP 1 DaysGrace FROM CustomerT ORDER BY DaysGrace
tblNames
CustomerID
FirstName
LastName
Phone
CustomerSince
CreditLimit
DaysGrace
IsActive
1
Richard
Rost
7165557777
01/01/2012
1001
1
True
10
Barbra
Peters
8292827288
31/12/2005
50
1
True
FORM
In a Form you could set the Default Value of a Textbox to
=DMIN("DaysGrace", "CustomerT", )
VBA
In a Form add a TEXTBOX control and rename it "txtDMin", then you could add the following in the Load Event.
Private Sub Form_Load()
txtDMin = DMin("DaysGrace", "CustomerT", )
End Sub