Hi--
I hope somoene can help me with this. I just cannot figure out how to get this to work. I want to have a Userform retain the last date that was selected in a DTPicker control but no matter what I try, it keeps defaulting to today's date.
The form opens specified files based on Region, Report Name and Date. So, for example - today is 10/17 amd I am pulling reports for the week ending 10/12:
1.I select 10/12 with the DatePicker, click my OK button and it opens the correct file.
2.I "Exit" the form (using the Exit button for which the code is posted above), do what I need to do with the file and close it.
3.Then when I invoke the form to open the next file, the date in the DatePicker defaults back to today's date rather than 10/12 remaining selected.
The Exit button has the following code:
Private Sub ExitButton_Click()
' Store settings
On Error Resume Next
SaveSetting AppName, "Settings", "ReportIndex", UserChoices(1)
SaveSetting AppName, "Settings", "RegionIndex", UserChoices(2)
SaveSetting AppName, "Settings", "DTPicker1", DTPicker1.Value
Unload Me
End Sub
and the form Initialize code is:
Private Sub UserForm_Initialize()
With Me
.Caption = AppName
.Width = 333
.Height = 100
End With
' Get previous settings
UserChoices(1) = GetSetting(AppName, "Settings", "ReportIndex", 0)
UserChoices(2) = GetSetting(AppName, "Settings", "RegionIndex", 0)
DTPicker1.Value = GetSetting(AppName, "Settings", "DTPicker1")
End Sub
Can anyone please offer any guidance?
Bookmarks