Hi PeopleWithMuchMoreKnowledge
I would appreciate some assistance with this:
Before I open a form, I want to retrieve the last values of each control on it (only checkboxes). Similarly save all settings before closing the form.
The prooblem that I have is that the code only runs the for loop once and does not recocknize any controls on my form.
Sub routine called on opening form:
subroutine called on closing the form:Code:Public Sub CheckLastSettings(fileName As String, mySystemType As String) On Error Resume Next Dim myCheckBox As CheckBox For Each myCheckBox In Me.Controls myCheckBox.Value = GetSetting(fileName, mySystemType, myCheckBox, 0) Next myCheckBox End Sub
The myChechbox variable created remains empty in both sub routines.Code:Public Sub SaveLastSettings(frmName As frmOptions, fileName As String, mySystemType As String) On Error Resume Next Dim myCheckBox As CheckBox For Each myCheckBox In frmOptions.Controls SaveSetting fileName, mySystemType, myCheckBox.Value, 0 Next myCheckBox End Sub
What am I missing?
Regards, Ossewa




Reply With Quote