Forum Discussion

TRundle2022's avatar
TRundle2022
Copper Contributor
Jun 14, 2022
Solved

Set default date on DatePicker from a drop down control event

Is it possible to have the default date of a date picker control be programmatically set when a user clicks a drop down? I have two controls, DropDown1 and DatePicker 1. What I would like, is when th...
  • RobElliott's avatar
    Jun 15, 2022

    TRundle2022 yes you can set the DefaultDate property to change based on the selection in the dropdown. Make sure you have set the first item in the dropdown to "" then set the DefaultDate property of the date picker to:

    If(Dropdown1.Selected.Value <> "",Today()+10,Today())

     

    Or you can do something like this to set it to a date based on which item in the dropdown has been selected:

    If(Dropdown1.Selected.Value ="Anguilla",Today()+10,If(Dropdown1.Selected.Value= "Antigua",Today()+20, Today()+30))

     

    Rob
    Los Gallardos
    Intranet, SharePoint and Power Platform Manager (and classic 1967 Morris Traveller driver)

Resources