I want to find field "id_zlecenia" - autonumber where field "DataPrzyjecia" - Date is youngest in table "tblZlecenia", I have a problem with WHERE, I know that, should use "#" for a date field, but I don't know how to write it.
Function - I think MAX will be ok.,
Dim sSQL As String
Dim rst As Recordset
sSQL = "SELECT id_zlecenia FROM tblZlecenia WHERE... "
Set rst = CurrentDb.OpenRecordset(sSQL)
Me.Tekst1 = rst!ID_Zlecenia
rst.Close: Set rst = Nothing
Not sure to understand what you mean with Date is youngest in table "tblZlecenia"
If DataPrzyjecia is of type Date/Time and if you want to retrieve the most recent date in this column, you can use (provided that no dates are in the future):