... und eine Stunde später hatte er sich doch selber was zusammengefrickelt
Verbesserungsvorschläge weiterhin willkommen
Code:
Public Function GetHint(Table As String, Field As String) As String
Dim strSQL As String
Dim
db As Database
Dim rs As Recordset
strSQL = "SELECT Avg([" & Table & "].[" & Field & "]) AS AvgValue, Min([" & Table & "].[" & Field & "]) AS MinValue, Max([" & Table & "].[" & Field & "]) AS MaxValue FROM [" & Table & "];"
Set
db = CurrentDb
Set rs =
db.OpenRecordset(strSQL, dbOpenDynaset)
rs.MoveFirst
strAvgValue = Round(rs.Fields![AvgValue], 2)
strMaxValue = Round(rs.Fields![MaxValue], 2)
strMinValue = Round(rs.Fields![MinValue], 2)
GetHint = "Durchschnitt: " & strAvgValue & vbCrLf & "Min: " & strMinValue & vbCrLf & "Max: " & strMaxValue
End Function
@SirThornberry: sorry für die Arbeit, war grad ziemlich fertig mit den Nerven