Forum Discussion
karenlorr_uk
Apr 13, 2021Copper Contributor
Find next date in table
If today is 25th December 2021 and I have a table with these dates [tbl_dates]![my_date] 01/02/2024 28/06/2035 17/04/2024 24/12/2021 23/05/2022 How can I populate a textbox on a form wi...
karenlorr_uk
Apr 13, 2021Copper Contributor
George_Hepworth
They are just dates stored in a date field in a table.
It's simple to do in a query
SELECT TOP 1 tbl_dates.My_date
FROM tbl_dates
WHERE (((tbl_dates.My_date)>Date()))
ORDER BY tbl_dates.My_date;
Or in a form you can use
DMin("my_date", "tbl_dates", "my_date > Date()")
But I was hoping for a form textbox simple expression
e.g.
=DMax("my_date","tbl_dates")
=DMin("my_date","tbl_dates")
LoL
Mind you it may not be possible. I'm sure there isn't a DNext
Gustav_Brock
Apr 15, 2021Iron Contributor
> I was hoping for a form textbox simple expression
There is. The expression to use as ControlSource is:
=DMin("my_date","tbl_dates","my_date > Date()")