If you want to bind 'TableName' to a data table, then you need to make it a collection, not a variable - instead of using
UpdateContext({TableName: Date_1})
You would use
ClearCollect(TableName, Date_1)
Which would make a copy of Date_1 in TableName.
Also notice that the If function can take several conditions in one single call, so you don't need to have this large number of nested If calls - your expression is roughly equivalent to the one below:
If(
OldDate = DatePicker1.SelectedDate,
UpdateContext({ PopUpDate:false }),
DateDiff(DatePicker1.SelectedDate, Today(), Days) = 1,
ClearCollect(TableName, Date_1),
DateDiff(DatePicker1.SelectedDate, Today(), Days) = 2,
ClearCollect(TableName, Date_2),
DateDiff(DatePicker1.SelectedDate, Today(), Days) = 3,
ClearCollect(TableName, Date_3),
DateDiff(DatePicker1.SelectedDate, Today(), Days) = 4,
ClearCollect(TableName, Date_4),
DateDiff(DatePicker1.SelectedDate, Today(), Days) = 5,
ClearCollect(TableName, Date_5),
DateDiff(DatePicker1.SelectedDate, Today(), Days) = 6,
ClearCollect(TableName, Date_6),
DateDiff(DatePicker1.SelectedDate, Today(), Days) = 7,
ClearCollect(TableName, Date_7),
DateDiff(DatePicker1.SelectedDate, Today(), Days) = 8,
ClearCollect(TableName, Date_8),
DateDiff(DatePicker1.SelectedDate, Today(), Days) = 9,
ClearCollect(TableName, Date_9),
DateDiff(DatePicker1.SelectedDate, Today(), Days) = 10,
ClearCollect(TableName, Date_10))
; UpdateContext({ PopUpDate:false })
Another change you can make - since most of the comparisons are done with the same value (DateDiff(DatePicker1.SelectedDate, Today(), Days)), then you can use the Switch function to make this expression simpler:
If(
OldDate = DatePicker1.SelectedDate,
UpdateContext({ PopUpDate:false }),
Switch(
DateDiff(DatePicker1.SelectedDate, Today(), Days),
1, ClearCollect(TableName, Date_1),
2, ClearCollect(TableName, Date_2),
3, ClearCollect(TableName, Date_3),
4, ClearCollect(TableName, Date_4),
5, ClearCollect(TableName, Date_5),
6, ClearCollect(TableName, Date_6),
7, ClearCollect(TableName, Date_7),
8, ClearCollect(TableName, Date_8),
9, ClearCollect(TableName, Date_9),
10, ClearCollect(TableName, Date_10)))
; UpdateContext({ PopUpDate:false })
The attached app shows how these expressions can be used.
Hope this helps!