Array

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

What function should I use if I have to find 2 smallest values from 4 fields
where I have numerical values? I think that DMin doesn't work there.
For example: I have values 54,56; 56,56; 34,45; 55,78 and I have to find 2
smaleest of them, but the are not in one column but in diferent columns
(fields)
 
I suspect you'll need to create your own function to do so. Access is
design to handle relational data -- if your data were normalized (all values
in one field/column), you could use the Top property of a query, a built in
capability.
 
Perhaps union your four fields into one field, and then use the Top 2 of that.

-- quniUnionQuery
Select Field1 as TheValue From tblYourTable
union
Select Field2 From tblYourTable
union
Select Field3 From tblYourTable
union
Select Field4 From tblYourTable

-- qryTop2
Select Top 2 TheValue From quniUnionQuery
Order By TheValue
Group By TheValue
 
Back
Top