most often value in a field

bbwolff

Registered User.
Local time
Today, 09:21
Joined
Oct 1, 2013
Messages
116
How can i get the value that is used most common in one column of the table through vba code?
 
You would need a DMean() function - something Access does not have.

Have a look at this link http://perrin.socsci.unc.edu/tips/src/daverages.txt. it lists a DMedian() and a DMode() function

EDIT
Just a thought, would a TOP 1 query do this??
Code:
SELECT TOP 1 Table1.Data
FROM Table1
GROUP BY Table1.Data
ORDER BY Count(Table1.Data) DESC;
 
this seems to work

Code:
Dim rs As DAO.Recordset
Dim strSQL As String

strSQL = "SELECT tName  FROM Table GROUP BY tName ORDER BY Count(table.tName) DESC;"

Set rs = CurrentDb.OpenRecordset(strSQL)

rs.MoveFirst

MsgBox rs!tName
 

Users who are viewing this thread

Back
Top Bottom