Function Brojevi() Dim DB As Database Dim SQL As String Dim Rs As Recordset Dim I As Integer Set DB = CurrentDb SQL = "SELECT Max(RedBr) FROM tblPopis" Set Rs = DB.OpenRecordset(SQL) If Format$(Rs.Fields(0)) <> "" Then I = Val(Rs.Fields(0)) End If I = I + 1 Brojevi = I Rs.Close Set DB = Nothing Kraj: End Function